Skip to content

Commit 8a1df44

Browse files
tighten up the PR
1 parent 9174abb commit 8a1df44

2 files changed

Lines changed: 2 additions & 36 deletions

File tree

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
1-
// import fs from 'node:fs';
21
import os from 'node:os';
3-
// import { assert, expect } from 'chai';
4-
// import sinon from 'sinon';
52

63
import { FileStateStore } from './file-state-store';
7-
// import type { StateStore } from './interface';
84
import { StateStoreChaiTestRunner } from './spec-utils';
95

106
const testRunner = new StateStoreChaiTestRunner({
@@ -13,33 +9,3 @@ const testRunner = new StateStoreChaiTestRunner({
139
}),
1410
});
1511
testRunner.enableTests('FileStateStore');
16-
17-
// describe('FileStateStore specifics', () => {
18-
// const stateStore: StateStore = new FileStateStore({
19-
// baseDir: os.tmpdir(),
20-
// });
21-
// const installUrlOptions = { scopes: ['channels:read'] };
22-
23-
// it('should close all files after writing them', async () => {
24-
// const writeFileSyncStub = sinon.stub(fs, 'writeFileSync').throws(new Error('mock_write_error'));
25-
26-
// try {
27-
// await stateStore.generateStateParam(installUrlOptions, new Date());
28-
// assert.fail('Exception should be thrown');
29-
// // biome-ignore lint/suspicious/noExplicitAny: errors can be anything
30-
// } catch (e: any) {
31-
// assert.equal(e.message, 'mock_write_error');
32-
// }
33-
34-
// assert(writeFileSyncStub.calledOnce, 'writeFileSync should be called once');
35-
// const fd = writeFileSyncStub.getCall(0).args[0] as number;
36-
37-
// expect(
38-
// () => fs.fstatSync(fd),
39-
// 'The file must be closed, we expect fstatSync to throw an error when the file is closed',
40-
// ).to.throw('EBADF: bad file descriptor, fstat');
41-
42-
// // Restore original function
43-
// writeFileSyncStub.restore();
44-
// });
45-
// });

packages/oauth/src/state-stores/spec-utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ export class StateStoreChaiTestRunner {
5959
}
6060
const state = await stateStore.generateStateParam(installUrlOptions, new Date());
6161

62-
// NOTE: wait 1 second to make sure IO operations completed
63-
await new Promise((resolve, _) => setTimeout(resolve, 1000));
62+
// NOTE: wait 0.5 second to ensure IO operations completed
63+
await new Promise((resolve, _) => setTimeout(resolve, 500));
6464

6565
const result = await stateStore.verifyStateParam(new Date(), state);
6666
assert.exists(result);

0 commit comments

Comments
 (0)