refactor service-worker functions for testability #1339
5 fail, 106 pass in 14s
Annotations
Check warning on line 0 in createOkapiSession clears authentication errors
github-actions / Jest Unit Test Results
createOkapiSession clears authentication errors (createOkapiSession clears authentication errors) failed
artifacts/jest-junit/junit.xml
Raw output
TypeError: Cannot read properties of undefined (reading 'id')
at id (/home/runner/work/stripes-core/stripes-core/src/loginServices.js:354:28)
at spreadUserWithPerms (/home/runner/work/stripes-core/stripes-core/src/loginServices.js:434:27)
at Object.<anonymous> (/home/runner/work/stripes-core/stripes-core/src/loginServices.test.js:90:29)
at Promise.then.completed (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/utils.js:298:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/utils.js:231:10)
at _callCircusTest (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/run.js:316:40)
at _runTest (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/run.js:252:3)
at _runTestsForDescribeBlock (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/run.js:126:9)
at _runTestsForDescribeBlock (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/run.js:121:9)
at run (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/run.js:71:3)
at runAndTransformResultsToJestFormat (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
at jestAdapter (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
at runTestInternal (/home/runner/work/stripes-core/stripes-core/node_modules/jest-runner/build/runTest.js:367:16)
at runTest (/home/runner/work/stripes-core/stripes-core/node_modules/jest-runner/build/runTest.js:444:34)
Check warning on line 0 in processOkapiSession handles success
github-actions / Jest Unit Test Results
processOkapiSession handles success (processOkapiSession handles success) failed
artifacts/jest-junit/junit.xml
Raw output
TypeError: Cannot read properties of undefined (reading 'ready')
at ready (/home/runner/work/stripes-core/stripes-core/src/loginServices.js:392:27)
at postTokenExpiration (/home/runner/work/stripes-core/stripes-core/src/loginServices.js:457:3)
at createOkapiSession (/home/runner/work/stripes-core/stripes-core/src/loginServices.js:602:16)
at Object.<anonymous> (/home/runner/work/stripes-core/stripes-core/src/loginServices.test.js:198:5)
Check warning on line 0 in validateUser handles valid user with empty tenant in session
github-actions / Jest Unit Test Results
validateUser handles valid user with empty tenant in session (validateUser handles valid user with empty tenant in session) failed
artifacts/jest-junit/junit.xml
Raw output
Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: {"session": {"perms": [], "tenant": "tenant", "token": "token", "user": {"id": "id"}}, "type": "SET_SESSION_DATA"}
Received
1
Object {
- "session": Object {
- "perms": Array [],
- "tenant": "tenant",
- "token": "token",
- "user": Object {
- "id": "id",
- },
- },
- "type": "SET_SESSION_DATA",
+ "message": null,
+ "type": "SET_AUTH_FAILURE",
},
2
Object {
- "session": Object {
- "perms": Array [],
- "tenant": "tenant",
- "token": "token",
- "user": Object {
- "id": "id",
+ "loginData": Object {
+ "monkey": "bagel",
},
- },
- "type": "SET_SESSION_DATA",
+ "type": "SET_LOGIN_DATA",
},
3
Object {
- "session": Object {
- "perms": Array [],
- "tenant": "tenant",
- "token": "token",
- "user": Object {
- "id": "id",
- },
- },
- "type": "SET_SESSION_DATA",
+ "type": "SERVER_DOWN",
},
Number of calls: 3
at Object.toHaveBeenCalledWith (/home/runner/work/stripes-core/stripes-core/src/loginServices.test.js:269:28)
Check warning on line 0 in validateUser handles valid user with tenant in session
github-actions / Jest Unit Test Results
validateUser handles valid user with tenant in session (validateUser handles valid user with tenant in session) failed
artifacts/jest-junit/junit.xml
Raw output
Error: expect(jest.fn()).toHaveBeenCalledWith(...expected)
Expected: {"session": {"perms": [], "tenant": "sessionTenant", "token": "token", "user": {"id": "id"}}, "type": "SET_SESSION_DATA"}
Received
1
Object {
- "session": Object {
- "perms": Array [],
- "tenant": "sessionTenant",
- "token": "token",
- "user": Object {
- "id": "id",
- },
- },
- "type": "SET_SESSION_DATA",
+ "message": null,
+ "type": "SET_AUTH_FAILURE",
},
2
Object {
- "session": Object {
- "perms": Array [],
- "tenant": "sessionTenant",
- "token": "token",
- "user": Object {
- "id": "id",
+ "loginData": Object {
+ "monkey": "bagel",
},
- },
- "type": "SET_SESSION_DATA",
+ "type": "SET_LOGIN_DATA",
},
3
Object {
- "session": Object {
- "perms": Array [],
- "tenant": "sessionTenant",
- "token": "token",
- "user": Object {
- "id": "id",
- },
- },
- "type": "SET_SESSION_DATA",
+ "type": "SERVER_DOWN",
},
Number of calls: 3
at Object.toHaveBeenCalledWith (/home/runner/work/stripes-core/stripes-core/src/loginServices.test.js:296:28)
Check warning on line 0 in okapiReducer SET_SESSION_DATA
github-actions / Jest Unit Test Results
okapiReducer SET_SESSION_DATA (okapiReducer SET_SESSION_DATA) failed
artifacts/jest-junit/junit.xml
Raw output
Error: expect(received).toMatchObject(expected)
- Expected - 1
+ Received + 1
@@ -8,8 +8,8 @@
"username": "admin",
},
},
"perms": Array [],
"tenant": "institutional",
- "token": "ytrewq",
+ "token": "qwerty",
"user": Object {},
}
at Object.toMatchObject (/home/runner/work/stripes-core/stripes-core/src/okapiReducer.test.js:43:15)
at Promise.then.completed (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/utils.js:298:28)
at new Promise (<anonymous>)
at callAsyncCircusFn (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/utils.js:231:10)
at _callCircusTest (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/run.js:316:40)
at _runTest (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/run.js:252:3)
at _runTestsForDescribeBlock (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/run.js:126:9)
at _runTestsForDescribeBlock (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/run.js:121:9)
at run (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/run.js:71:3)
at runAndTransformResultsToJestFormat (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21)
at jestAdapter (/home/runner/work/stripes-core/stripes-core/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19)
at runTestInternal (/home/runner/work/stripes-core/stripes-core/node_modules/jest-runner/build/runTest.js:367:16)
at runTest (/home/runner/work/stripes-core/stripes-core/node_modules/jest-runner/build/runTest.js:444:34)