From f3b819009b0bce417c77a2f57bbd68e617292340 Mon Sep 17 00:00:00 2001 From: Sami Mazouz Date: Fri, 8 Mar 2024 21:24:05 +0100 Subject: [PATCH] tet: adapt frontend tests --- .../js/tests/unit/common/GambitManager.test.ts | 6 +++--- js-packages/jest-config/setup-env.js | 18 ++++++++++++++++-- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/framework/core/js/tests/unit/common/GambitManager.test.ts b/framework/core/js/tests/unit/common/GambitManager.test.ts index d27e1a614..138f20aff 100644 --- a/framework/core/js/tests/unit/common/GambitManager.test.ts +++ b/framework/core/js/tests/unit/common/GambitManager.test.ts @@ -7,7 +7,7 @@ test('gambits are converted to filters', function () { q: 'lorem', created: '2023-07-07', hidden: true, - author: ['behz'], + author: 'behz', }); }); @@ -16,7 +16,7 @@ test('gambits are negated when prefixed with a dash', function () { q: 'lorem', '-created': '2023-07-07', '-hidden': true, - '-author': ['behz'], + '-author': 'behz', }); }); @@ -29,6 +29,6 @@ test('gambits are only applied for the correct resource type', function () { q: 'lorem email:behz@machine.local', created: '2023-07-07..2023-10-18', hidden: true, - '-author': ['behz'], + '-author': 'behz', }); }); diff --git a/js-packages/jest-config/setup-env.js b/js-packages/jest-config/setup-env.js index 5b20e8985..bf95a0ded 100644 --- a/js-packages/jest-config/setup-env.js +++ b/js-packages/jest-config/setup-env.js @@ -19,11 +19,25 @@ function bootApp() { { type: 'forums', id: '1', - attributes: {}, + attributes: { + canEditUserCredentials: true, + }, + }, + { + type: 'users', + id: '1', + attributes: { + id: 1, + username: 'admin', + displayName: 'Admin', + email: 'admin@machine.local', + joinTime: '2021-01-01T00:00:00Z', + isEmailConfirmed: true, + }, }, ], session: { - userId: 0, + userId: 1, csrfToken: 'test', }, });