Repository navigation
test(oauth): use node:test mocks instead of sinon - #2817
Conversation
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2817 +/- ##
==========================================
+ Coverage 93.77% 93.83% +0.05%
==========================================
Files 66 66
Lines 10571 10571
Branches 611 611
==========================================
+ Hits 9913 9919 +6
+ Misses 621 616 -5
+ Partials 37 36 -1
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
mwbrooks
left a comment
There was a problem hiding this comment.
✅ Thanks @WilliamBergamin! Folding the 14 copied state stores into one helper makes these tests so much easier to read.
| // fsReaddirSync returns ['app-latest', 'user-userId-latest'] | ||
| assert.strictEqual(fsUnlinkSync.callCount, 2); | ||
| assert.deepEqual(callsTo(fsReaddirSync), [[fakeInstallDir]]); | ||
| assert.deepEqual(callsTo(fsUnlinkSync), [ |
There was a problem hiding this comment.
praise: Asserting the exact unlink paths is a real upgrade, since the old substring match passed even when the store deleted from the wrong directory 🎯
Summary
This pull request replaces
sinonwith the built-innode:testmocks in@slack/oauthtests and removessinonfrom its devDependencies. It follows #2811, which did the same for@slack/cli-hooks.createFakeStateStore()helper.Testing
src/installation-stores/file-store.ts, changedeleteFile(path.join(installationDir, filePath))todeleteFile(filePath). Both delete tests fail (they pass onmain). Revert.packages/oauth, runnode --import tsx --test 'src/**/*.test.ts'. All 76 tests pass. (npm testonly runs 16 of them until build: run every test file in oauth and cli-test #2818 merges.)Requirements
🤖 Generated with Claude Code