@amedia/user 0.14.18 → 0.14.19

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/package.json +2 -3
  2. package/src/actions/authentication.spec.ts +0 -51
  3. package/src/actions/authentication.ts +0 -49
  4. package/src/actions/authorization.spec.ts +0 -377
  5. package/src/actions/authorization.ts +0 -120
  6. package/src/actions/preferences.spec.ts +0 -41
  7. package/src/actions/preferences.ts +0 -41
  8. package/src/actions/storage.ts +0 -22
  9. package/src/actions/userData.spec.ts +0 -133
  10. package/src/actions/userData.ts +0 -68
  11. package/src/autologin/index.spec.ts +0 -264
  12. package/src/autologin/index.ts +0 -113
  13. package/src/autologin/thirdPartyCookie.spec.ts +0 -95
  14. package/src/autologin/thirdPartyCookie.ts +0 -55
  15. package/src/cache/engines/global.spec.ts +0 -62
  16. package/src/cache/engines/global.ts +0 -49
  17. package/src/cache/index.spec.ts +0 -132
  18. package/src/cache/index.ts +0 -48
  19. package/src/cache/types.ts +0 -12
  20. package/src/clients/europa.spec.ts +0 -209
  21. package/src/clients/europa.ts +0 -183
  22. package/src/clients/jupiter.spec.ts +0 -178
  23. package/src/clients/jupiter.ts +0 -119
  24. package/src/clients/mercury.spec.ts +0 -126
  25. package/src/clients/mercury.ts +0 -105
  26. package/src/clients/mercuryLog.spec.ts +0 -20
  27. package/src/clients/mercuryLog.ts +0 -67
  28. package/src/clients/nebula.spec.ts +0 -70
  29. package/src/clients/nebula.ts +0 -83
  30. package/src/clients/pluto.spec.ts +0 -262
  31. package/src/clients/pluto.ts +0 -126
  32. package/src/eventHandlers/activation.ts +0 -40
  33. package/src/eventHandlers/authentication.ts +0 -34
  34. package/src/eventHandlers/eventMap.ts +0 -40
  35. package/src/eventHandlers/navigation.spec.ts +0 -189
  36. package/src/eventHandlers/navigation.ts +0 -58
  37. package/src/eventHandlers/state.spec.ts +0 -48
  38. package/src/eventHandlers/state.ts +0 -23
  39. package/src/eventHandlers/storage.spec.ts +0 -114
  40. package/src/eventHandlers/storage.ts +0 -45
  41. package/src/eventHandlers/userAttributes.spec.ts +0 -93
  42. package/src/eventHandlers/userAttributes.ts +0 -31
  43. package/src/exceptions/FetchTimeoutError.ts +0 -8
  44. package/src/exceptions/PaywallError.ts +0 -16
  45. package/src/index-authentcation.spec.ts +0 -26
  46. package/src/index-storage.spec.ts +0 -144
  47. package/src/index-subscription.spec.ts +0 -213
  48. package/src/index.ts +0 -46
  49. package/src/janitor/index.spec.ts +0 -18
  50. package/src/janitor/index.ts +0 -60
  51. package/src/janitor/jobs/accessCookieRefresher.spec.ts +0 -213
  52. package/src/janitor/jobs/accessCookieRefresher.ts +0 -96
  53. package/src/janitor/jobs/daxsubCookie.spec.ts +0 -109
  54. package/src/janitor/jobs/daxsubCookie.ts +0 -38
  55. package/src/janitor/jobs/removeUserStorage.spec.ts +0 -34
  56. package/src/janitor/jobs/removeUserStorage.ts +0 -12
  57. package/src/lib/PaywallUnlockRequest.spec.ts +0 -446
  58. package/src/lib/PaywallUnlockRequest.ts +0 -161
  59. package/src/lib/UserDataRequest.spec.ts +0 -231
  60. package/src/lib/UserDataRequest.ts +0 -267
  61. package/src/lib/cookie.ts +0 -121
  62. package/src/lib/rpc.ts +0 -19
  63. package/src/store/index.spec.ts +0 -49
  64. package/src/store/index.ts +0 -66
  65. package/src/types.ts +0 -22
  66. package/src/utils/customEventWrapper.spec.ts +0 -237
  67. package/src/utils/customEventWrapper.ts +0 -77
  68. package/src/utils/debouncer.spec.ts +0 -252
  69. package/src/utils/debouncer.ts +0 -123
  70. package/src/utils/deepEquals.ts +0 -42
  71. package/src/utils/expectBootLogs.ts +0 -9
  72. package/src/utils/getGlobalThis.ts +0 -17
  73. package/src/utils/getOrUpdate.spec.ts +0 -166
  74. package/src/utils/getOrUpdate.ts +0 -66
  75. package/src/utils/localhostCheck.ts +0 -10
  76. package/src/utils/location.spec.ts +0 -61
  77. package/src/utils/location.ts +0 -16
  78. package/src/utils/log.spec.ts +0 -177
  79. package/src/utils/log.ts +0 -112
  80. package/src/utils/loginState.ts +0 -24
  81. package/src/utils/networkError.ts +0 -11
  82. package/src/utils/queue.ts +0 -32
  83. package/src/utils/type.ts +0 -19
  84. package/src/utils/url.spec.ts +0 -33
  85. package/src/utils/url.ts +0 -37
@@ -1,55 +0,0 @@
1
- import { Boolean, Record, Static, String } from 'runtypes';
2
- import cache from '../cache';
3
- import log from '../utils/log';
4
- import { getAidDomain } from '../utils/url';
5
- import { resolveBadPlutoResponse } from '../clients/pluto';
6
-
7
- export const CACHE_KEY = 'haveTriedThirdPartyLoginCheck';
8
- export const CACHE_TTL = 60 * 60 * 1000; // One hour
9
-
10
- const ServiceSessionSchema = Record({
11
- user_name: String,
12
- tracking_key: String,
13
- });
14
-
15
- const getAidSession = () =>
16
- <Promise<Static<typeof ServiceSessionSchema> | null>>fetch(
17
- `https://${getAidDomain()}/api/pluto/v1/sessions/current`,
18
- {
19
- mode: 'cors',
20
- credentials: 'include',
21
- }
22
- )
23
- .then((response) => {
24
- if (!response.ok) {
25
- return resolveBadPlutoResponse(response)
26
- .then(() => null)
27
- .catch(() => null);
28
- }
29
- return response.json();
30
- })
31
- .then((data) => {
32
- if (!data) {
33
- return null;
34
- }
35
- try {
36
- return ServiceSessionSchema.check(data);
37
- } catch (error) {
38
- log.error(error, { data });
39
- return null;
40
- }
41
- });
42
-
43
- export default async function thirdPartyCookie() {
44
- // TODO: Should perhaps use cookie for this? Cache as it stands now only survives on the current page until vi replace it with something more persistent
45
- if (await cache.get(CACHE_KEY, Boolean)) {
46
- return false;
47
- }
48
- await cache.set(CACHE_KEY, true, CACHE_TTL);
49
-
50
- const aidSession = await getAidSession();
51
- if (aidSession) {
52
- return true;
53
- }
54
- return false;
55
- }
@@ -1,62 +0,0 @@
1
- import { clear, get, remove, set } from './global';
2
-
3
- beforeEach(() => {
4
- global.amediaUserCache = {};
5
- });
6
-
7
- describe('Global / window cache', () => {
8
- it('should return undefined if not in cache', () => {
9
- expect(get('test')).resolves.toBeUndefined();
10
- });
11
-
12
- it('should return if in cache', () => {
13
- set('test', 'value', 1000);
14
- expect(get('test')).resolves.toEqual({
15
- key: 'test',
16
- data: 'value',
17
- expires: 1000,
18
- });
19
- expect(global.amediaUserCache).toEqual({
20
- test: { key: 'test', data: 'value', expires: 1000 },
21
- });
22
- });
23
-
24
- it('should be able to set most data', () => {
25
- set('numeric', 5, 0);
26
- expect(get('numeric')).resolves.toEqual({
27
- key: 'numeric',
28
- data: 5,
29
- expires: 0,
30
- });
31
-
32
- set('object', { name: 'Donald Duck' }, 0);
33
- expect(get('object')).resolves.toEqual({
34
- key: 'object',
35
- data: { name: 'Donald Duck' },
36
- expires: 0,
37
- });
38
- });
39
-
40
- it('should overwrite existing data', () => {
41
- set('test', 'data', 0);
42
- set('test', 'other', 0);
43
- expect(get('test')).resolves.toEqual({
44
- key: 'test',
45
- data: 'other',
46
- expires: 0,
47
- });
48
- });
49
-
50
- it('should remove data from cache', () => {
51
- set('test', 'value', 0);
52
- expect(get('test')).resolves.not.toBeUndefined();
53
- remove('test');
54
- expect(get('test')).resolves.toBeUndefined();
55
- });
56
-
57
- it('should clear cache', () => {
58
- set('test', 'value', 0);
59
- clear();
60
- expect(global.amediaUserCache).toEqual({});
61
- });
62
- });
@@ -1,49 +0,0 @@
1
- import { CacheEntry, Engine } from '../types';
2
- import getGlobalThis from '../../utils/getGlobalThis';
3
-
4
- declare global {
5
- // eslint-disable-next-line import/no-mutable-exports,no-var
6
- export var amediaUserCache: { [index: string]: CacheEntry };
7
-
8
- interface Window {
9
- amediaUserCache?: { [index: string]: CacheEntry };
10
- }
11
-
12
- namespace NodeJS {
13
- interface Global {
14
- amediaUserCache?: { [index: string]: CacheEntry };
15
- }
16
- }
17
- }
18
-
19
- const getStorage = () => {
20
- const rootObject = getGlobalThis();
21
- // eslint-disable-next-line no-return-assign
22
- return rootObject.amediaUserCache || (rootObject.amediaUserCache = {});
23
- };
24
-
25
- export const get = (key: string): Promise<CacheEntry> => {
26
- const data = getStorage()[key];
27
- return Promise.resolve(data);
28
- };
29
-
30
- export const set = (
31
- key: string,
32
- data: unknown,
33
- expires: number
34
- ): Promise<void> => {
35
- getStorage()[key] = { key, data, expires };
36
- return Promise.resolve();
37
- };
38
-
39
- export const remove = (key: string): Promise<void> => {
40
- delete getStorage()[key];
41
- return Promise.resolve();
42
- };
43
-
44
- export const clear = (): Promise<void> => {
45
- getGlobalThis().amediaUserCache = {};
46
- return Promise.resolve();
47
- };
48
-
49
- export default { get, set, remove, clear } as Engine;
@@ -1,132 +0,0 @@
1
- import { Record, String } from 'runtypes';
2
- import * as MockDate from 'mockdate';
3
- import cache, { setCacheEngine } from '.';
4
- import { setLogger } from '../utils/log';
5
- import { version } from '../../eik.json';
6
-
7
- const TestDataSchema = Record({
8
- test: String,
9
- });
10
-
11
- let log: any;
12
- let mockEngine: any;
13
- beforeEach(() => {
14
- MockDate.reset();
15
- // @ts-ignore
16
- mockEngine = {
17
- get: jest.fn(),
18
- set: jest.fn(),
19
- remove: jest.fn(),
20
- clear: jest.fn(),
21
- };
22
- // @ts-ignore
23
- setCacheEngine(mockEngine);
24
- log = {
25
- error: jest.fn(),
26
- };
27
- setLogger(log);
28
- });
29
-
30
- describe('Cache', () => {
31
- describe('get', () => {
32
- it('should get from engine', () => {
33
- mockEngine.get.mockReturnValueOnce(Promise.resolve(null));
34
- expect(cache.get('foo', TestDataSchema)).resolves.toBeUndefined();
35
- expect(mockEngine.get).toHaveBeenCalledWith('foo');
36
- });
37
-
38
- it('should validate valid data from engine', () => {
39
- mockEngine.get.mockReturnValueOnce(
40
- Promise.resolve({
41
- key: 'foo',
42
- data: {
43
- test: 'cache',
44
- },
45
- expires: Date.now() + 1000,
46
- })
47
- );
48
- expect(cache.get('foo', TestDataSchema)).resolves.toEqual({
49
- test: 'cache',
50
- });
51
- });
52
-
53
- it('should return undefined and delete record on invalid data', async () => {
54
- mockEngine.get.mockReturnValueOnce(
55
- Promise.resolve({
56
- key: 'foo',
57
- data: {
58
- invalid: 'data',
59
- },
60
- expires: Date.now() + 1000,
61
- })
62
- );
63
- await expect(cache.get('foo', TestDataSchema)).resolves.toBeUndefined();
64
- expect(mockEngine.get).toHaveBeenCalledWith('foo');
65
- expect(mockEngine.remove).toHaveBeenCalledWith('foo');
66
- expect(log.error).toHaveBeenCalledWith(
67
- 'Expected { test: string; }, but was incompatible',
68
- {
69
- error: {
70
- code: 'CONTENT_INCORRECT',
71
- details: {
72
- test: 'Expected string, but was missing',
73
- },
74
- message: 'Expected { test: string; }, but was incompatible',
75
- name: 'ValidationError',
76
- stack: expect.stringMatching(
77
- /ValidationError: Expected \{ test: string; \}, but was incompatible\n(^\s+at\s.+$\n){3,}/m
78
- ),
79
- },
80
- cacheData: { invalid: 'data' },
81
- origin: '@amedia/user',
82
- originVersion: version,
83
- }
84
- );
85
- });
86
-
87
- it('deletes expired data', async () => {
88
- mockEngine.get.mockReturnValueOnce(
89
- Promise.resolve({
90
- key: 'foo',
91
- data: {
92
- test: 'cache',
93
- },
94
- expires: Date.now() - 1000,
95
- })
96
- );
97
- await expect(cache.get('foo', TestDataSchema)).resolves.toBeUndefined();
98
- expect(mockEngine.get).toHaveBeenCalledWith('foo');
99
- expect(mockEngine.remove).toHaveBeenCalledWith('foo');
100
- });
101
- });
102
-
103
- describe('set', () => {
104
- it('should set', () => {
105
- const EXPIRES = 987654321;
106
- const MOCK_NOW_TIMESTAMP = 123456789;
107
- MockDate.set(MOCK_NOW_TIMESTAMP);
108
- cache.set('test-key', { test: 'data' }, EXPIRES);
109
- expect(mockEngine.set).toHaveBeenCalledWith(
110
- 'test-key',
111
- { test: 'data' },
112
- MOCK_NOW_TIMESTAMP + EXPIRES
113
- );
114
- });
115
- });
116
-
117
- describe('remove', () => {
118
- it('should remove', () => {
119
- expect(mockEngine.remove).not.toHaveBeenCalled();
120
- cache.remove('some-key');
121
- expect(mockEngine.remove).toHaveBeenCalledWith('some-key');
122
- });
123
- });
124
-
125
- describe('clear', () => {
126
- it('should clear', () => {
127
- expect(mockEngine.clear).not.toHaveBeenCalled();
128
- cache.clear();
129
- expect(mockEngine.clear).toHaveBeenCalled();
130
- });
131
- });
132
- });
@@ -1,48 +0,0 @@
1
- import { Static } from 'runtypes';
2
- import { RuntypeBase } from 'runtypes/lib/runtype';
3
- import log from '../utils/log';
4
- import globalCache from './engines/global';
5
- import { Engine } from './types';
6
-
7
- let cacheEngine: Engine;
8
-
9
- export const setCacheEngine = (engine: Engine) => {
10
- cacheEngine = engine;
11
- };
12
-
13
- const getCacheEngine = (): Engine => cacheEngine || globalCache;
14
-
15
- const set = (key: string, value: unknown, expires: number) =>
16
- getCacheEngine().set(key, value, Date.now() + expires);
17
-
18
- const remove = (key: string): Promise<void> => getCacheEngine().remove(key);
19
-
20
- const get = async <T extends RuntypeBase>(
21
- key: string,
22
- validator: T
23
- ): Promise<Static<T> | void> => {
24
- const cacheEntry = await getCacheEngine().get(key);
25
- if (!cacheEntry) {
26
- return Promise.resolve();
27
- }
28
- if (Date.now() > cacheEntry.expires) {
29
- remove(key);
30
- return Promise.resolve();
31
- }
32
- try {
33
- return validator.check(cacheEntry.data);
34
- } catch (error) {
35
- log.error(error, { cacheData: cacheEntry.data });
36
- remove(key);
37
- return Promise.resolve();
38
- }
39
- };
40
-
41
- const clear = () => getCacheEngine().clear();
42
-
43
- export default {
44
- get,
45
- set,
46
- remove,
47
- clear,
48
- };
@@ -1,12 +0,0 @@
1
- export type CacheEntry = {
2
- key: string;
3
- data: unknown;
4
- expires: number;
5
- };
6
-
7
- export type Engine = {
8
- get: (key: string) => Promise<CacheEntry | null>;
9
- set: (key: string, data: unknown, expires: number) => Promise<void>;
10
- remove: (key: string) => Promise<void>;
11
- clear: () => Promise<void>;
12
- };
@@ -1,209 +0,0 @@
1
- import fetch from 'jest-fetch-mock';
2
- import cache from '../cache';
3
- import {
4
- updateNamespace,
5
- EuropaSchema,
6
- clearLocalCache,
7
- saveNamespace,
8
- deleteNamespaceKey,
9
- getNamespaces,
10
- getAllNamespaces,
11
- } from './europa';
12
-
13
- beforeEach(() => {
14
- cache.clear();
15
- });
16
-
17
- describe('Europa', () => {
18
- it('saveNamespace should set namespace and return the new value', async () => {
19
- const userInfo = { gender: 'U', post_code: 'U' };
20
- fetch
21
- .mockOnce(JSON.stringify(userInfo)) // data to save 'PUT'
22
- .mockOnce(JSON.stringify({ namespaces: { user_info: userInfo } })); // data retrieved 'GET'
23
-
24
- const namespaceData = await saveNamespace('user_info', userInfo);
25
- expect(fetch).toHaveBeenCalledTimes(2);
26
- expect(namespaceData).toMatchObject({ user_info: userInfo });
27
- });
28
-
29
- it('updateNamespace should update namespace', async () => {
30
- const oldUserInfo = { gender: 'F', post_code: 'U' };
31
- const newUserInfo = { gender: 'M', post_code: '2150' };
32
-
33
- fetch.mockOnce(JSON.stringify({})); // initial response // 'PUT'
34
- fetch.mockOnce(JSON.stringify({ namespaces: { user_info: oldUserInfo } })); // old 'GET'
35
- fetch.mockOnce(JSON.stringify({ namespaces: { user_info: newUserInfo } })); // updated 'GET'
36
-
37
- const old = await saveNamespace('user_info', oldUserInfo);
38
- expect(fetch).toHaveBeenCalledTimes(2);
39
- expect(old).toEqual({ user_info: oldUserInfo });
40
-
41
- const updated = await updateNamespace('user_info', newUserInfo).then(() =>
42
- cache.get('europa', EuropaSchema)
43
- );
44
- expect(updated).toMatchObject({ user_info: newUserInfo });
45
- expect(fetch).toHaveBeenCalledTimes(3);
46
- });
47
-
48
- it('clearLocalCache should remove Europa cache', async () => {
49
- fetch.mockResponse(JSON.stringify({ namespaces: { euucp: { x: 'x' } } }));
50
-
51
- await saveNamespace('euucp', { x: 'x' });
52
- expect(cache.get('europa', EuropaSchema)).resolves.toMatchObject({
53
- euucp: { x: 'x' },
54
- }); // expect something in cache
55
-
56
- await clearLocalCache();
57
- expect(cache.get('europa', EuropaSchema)).resolves.toBeUndefined(); // expect cache to be empty
58
- });
59
-
60
- it('deleteNamespaceKey should remove key from europa', async () => {
61
- fetch
62
- .mockOnce(JSON.stringify({})) // 'GET'
63
- .mockOnce(JSON.stringify({ namespaces: { euucp: { x: 'x', y: 'y' } } })) // 'PUT'
64
- .mockOnce(JSON.stringify({}), { status: 200 }) // 'DELETE'
65
- .mockOnce(JSON.stringify({ namespaces: { euucp: { y: 'y' } } })); // 'PUT'
66
-
67
- const data = { x: 'x', y: 'y' };
68
-
69
- await saveNamespace('euucp', data);
70
- // expect x and y
71
- expect(await cache.get('europa', EuropaSchema)).toEqual(
72
- expect.objectContaining({
73
- euucp: data,
74
- })
75
- );
76
-
77
- await deleteNamespaceKey('euucp', 'x');
78
- // expect only y
79
- expect(await cache.get('europa', EuropaSchema)).toEqual(
80
- expect.objectContaining({
81
- euucp: { y: 'y' },
82
- })
83
- );
84
- });
85
-
86
- it('getAllNamespaces should return all europa namespaces', async () => {
87
- const data = {
88
- euucp: { x: 'x' },
89
- user_info: { gender: 'M', post_code: 'U' },
90
- };
91
-
92
- fetch.mockResponse(JSON.stringify({ namespaces: data }));
93
- expect(await getAllNamespaces()).toMatchObject({ namespaces: data });
94
- });
95
- });
96
-
97
- describe('getNamespaces', () => {
98
- let response: any;
99
- describe('with cold cache', () => {
100
- describe('with one namespace', () => {
101
- const data = { euucp: { x: 'x' } };
102
- beforeEach(async () => {
103
- fetch.mockResponse(JSON.stringify({ namespaces: data }));
104
- response = await getNamespaces(['euucp']);
105
- });
106
- it('should return namespace', () => {
107
- expect(response).toEqual(data);
108
- });
109
- });
110
-
111
- describe('with multiple namespaces', () => {
112
- const data = { euucp: { x: 'x' }, user_info: { a: 'a' } };
113
- beforeEach(async () => {
114
- fetch.mockResponse(JSON.stringify({ namespaces: data }));
115
- response = await getNamespaces(['euucp', 'user_info']);
116
- });
117
- it('should return multiple namespaces', () => {
118
- expect(response).toEqual(data);
119
- });
120
- });
121
-
122
- describe('when doing sequence of calls for different namespaces', () => {
123
- const data = { euucp: { x: 'x' } };
124
- const data2 = { user_info: { a: 'a' } };
125
- let response2: any;
126
- beforeEach(async () => {
127
- fetch.mockResponseOnce(JSON.stringify({ namespaces: data }));
128
- fetch.mockResponseOnce(JSON.stringify({ namespaces: data2 }));
129
- response = await getNamespaces(['euucp']);
130
- response2 = await getNamespaces(['user_info']);
131
- });
132
- it('should return multiple namespaces', () => {
133
- expect(response).toEqual(data);
134
- expect(response2).toEqual(data2);
135
- });
136
- });
137
-
138
- describe('when doing sequence of calls for different namespaces before first response returns', () => {
139
- const data = { euucp: { x: 'x' } };
140
- const data2 = { user_info: { a: 'a' } };
141
- let response2: any;
142
- beforeEach(async () => {
143
- fetch.mockResponseOnce(
144
- JSON.stringify({ namespaces: { ...data, ...data2 } })
145
- );
146
- const futureEuucp = getNamespaces(['euucp']);
147
- response2 = await getNamespaces(['user_info']);
148
- response = await futureEuucp;
149
- });
150
- it('should return euucp in first response', () => {
151
- expect(response).toEqual(data);
152
- });
153
- it('should return user_info in second response', () => {
154
- expect(response2).toEqual(data2);
155
- });
156
- });
157
- });
158
-
159
- describe('with one namespace in cache', () => {
160
- const data = { euucp: { x: 'x' } };
161
- beforeEach(() => {
162
- cache.set('europa', data, 100000);
163
- });
164
-
165
- describe('when requesting cached namespace', () => {
166
- beforeEach(async () => {
167
- response = await getNamespaces(['euucp']);
168
- });
169
- it('should return namespace', () => {
170
- expect(response).toEqual(data);
171
- });
172
- });
173
-
174
- describe('when requesting namespace not found in cache', () => {
175
- const expectedData = {
176
- privacy_preferences: { allow_research_usage: true },
177
- };
178
-
179
- beforeEach(async () => {
180
- fetch.mockResponse(JSON.stringify({ namespaces: expectedData }));
181
- response = await getNamespaces(['privacy_preferences']);
182
- });
183
- it('should return namespace from backend, not from cache', () => {
184
- expect(response).toEqual(expectedData);
185
- });
186
- });
187
-
188
- describe('when requesting multiple namespaces and only one found in cache', () => {
189
- const expectedData = {
190
- privacy_preferences: { allow_research_usage: true },
191
- euucp: { x: 'x' },
192
- };
193
-
194
- beforeEach(async () => {
195
- fetch.mockResponse(JSON.stringify({ namespaces: expectedData }));
196
- response = await getNamespaces(['privacy_preferences', 'euucp']);
197
- });
198
- it('should return namespace from backend, not from cache', () => {
199
- expect(response).toEqual(expectedData);
200
- });
201
- });
202
- });
203
-
204
- it('should require at least one namespace', () => {
205
- expect(getNamespaces([])).rejects.toThrowError(
206
- new Error('namespaces array cannot be of length 0')
207
- );
208
- });
209
- });