session
session copied to clipboard
Fix reload callback session construction + remove duplication of code by refactoring the callback/promise handling code
Tests:
PASS test/memorystore.test.js 16 OK 63.406ms
PASS test/idGenerator.test.js 512 OK 140.972ms
PASS test/fastifySession.checkOptions.test.js 12 OK 146.505ms
PASS test/store.test.js 11 OK 189.105ms
PASS test/base.test.js 62 OK 460.55ms
PASS test/cookie.test.js 72 OK 508.147ms
PASS test/session.test.js 123 OK 677.57ms
PASS test/verifyPath.test.js 34 OK 116.583ms
PASS test/expiration.test.js 5 OK 2s
🌈 SUMMARY RESULTS 🌈
Suites: 9 passed, 9 of 9 completed
Asserts: 847 passed, of 847
Time: 4s
-------------------|---------|----------|---------|---------|-------------------
File | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-------------------|---------|----------|---------|---------|-------------------
All files | 100 | 100 | 100 | 100 |
cookie.js | 100 | 100 | 100 | 100 |
fastifySession.js | 100 | 100 | 100 | 100 |
idGenerator.js | 100 | 100 | 100 | 100 |
session.js | 100 | 100 | 100 | 100 |
store.js | 100 | 100 | 100 | 100 |
-------------------|---------|----------|---------|---------|-------------------
Benchmark (they do not run on my machine even with clean install):
╔══════════════╤═════════╤═════════╤═══════════╤═════════════════════════╗
║ Slower tests │ Samples │ Result │ Tolerance │ Difference with slowest ║
╟──────────────┼─────────┼─────────┼───────────┼─────────────────────────╢
║ redis │ 0 │ Errored │ N/A │ N/A ║
║ file │ 0 │ Errored │ N/A │ N/A ║
╟──────────────┼─────────┼─────────┼───────────┼─────────────────────────╢
║ Fastest test │ Samples │ Result │ Tolerance │ Difference with slowest ║
╟──────────────┼─────────┼─────────┼───────────┼─────────────────────────╢
║ memory │ 0 │ Errored │ N/A │ N/A ║
╚══════════════╧═════════╧═════════╧═══════════╧═════════════════════════╝
Checklist
- [x] run
npm run testandnpm run benchmark - [x] tests and/or benchmarks are included
- [x] documentation is changed or added (no)
- [x] commit message and code follows the Developer's Certification of Origin and the Code of conduct