@jasperoosthoek/zustand-auth-registry 0.0.1 → 0.0.2
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.
- package/README.md +107 -293
- package/dist/authConfig.d.ts +25 -20
- package/dist/authStore.d.ts +3 -3
- package/dist/errors.d.ts +39 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/useAuth.d.ts +3 -2
- package/package.json +2 -1
- package/src/authConfig.ts +119 -112
- package/src/authStore.ts +46 -57
- package/src/createAuthRegistry.ts +1 -1
- package/src/errors.ts +104 -0
- package/src/index.ts +2 -1
- package/src/useAuth.ts +181 -101
- package/dist/setupTests.d.ts +0 -1
- package/src/__tests__/authConfig.test.ts +0 -463
- package/src/__tests__/authStore.test.ts +0 -608
- package/src/__tests__/createAuthRegistry.test.ts +0 -202
- package/src/__tests__/testHelpers.ts +0 -92
- package/src/__tests__/testUtils.ts +0 -142
- package/src/__tests__/useAuth.test.ts +0 -975
- package/src/setupTests.ts +0 -46
package/src/setupTests.ts
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
// Test setup with React Testing Library and jsdom
|
|
2
|
-
import '@testing-library/react';
|
|
3
|
-
|
|
4
|
-
// Mock console to reduce noise during tests
|
|
5
|
-
global.console = {
|
|
6
|
-
...console,
|
|
7
|
-
error: jest.fn(),
|
|
8
|
-
warn: jest.fn(),
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
// Mock localStorage for auth persistence testing
|
|
12
|
-
const createStorageMock = () => ({
|
|
13
|
-
getItem: jest.fn(),
|
|
14
|
-
setItem: jest.fn(),
|
|
15
|
-
removeItem: jest.fn(),
|
|
16
|
-
clear: jest.fn(),
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
Object.defineProperty(window, 'localStorage', {
|
|
20
|
-
value: createStorageMock(),
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
Object.defineProperty(window, 'sessionStorage', {
|
|
24
|
-
value: createStorageMock(),
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
// Mock axios for all tests
|
|
28
|
-
jest.mock('axios', () => ({
|
|
29
|
-
create: jest.fn(() => ({
|
|
30
|
-
get: jest.fn(),
|
|
31
|
-
post: jest.fn(),
|
|
32
|
-
put: jest.fn(),
|
|
33
|
-
patch: jest.fn(),
|
|
34
|
-
delete: jest.fn(),
|
|
35
|
-
defaults: {
|
|
36
|
-
headers: {
|
|
37
|
-
common: {}
|
|
38
|
-
}
|
|
39
|
-
},
|
|
40
|
-
interceptors: {
|
|
41
|
-
request: { use: jest.fn(), eject: jest.fn() },
|
|
42
|
-
response: { use: jest.fn(), eject: jest.fn() }
|
|
43
|
-
}
|
|
44
|
-
})),
|
|
45
|
-
isAxiosError: jest.fn()
|
|
46
|
-
}));
|