Skip to content

Commit 80d53c7

Browse files
committed
style: lint
1 parent 72a5125 commit 80d53c7

3 files changed

Lines changed: 23 additions & 11 deletions

File tree

packages/oauth/src/install-provider.test.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ describe('InstallProvider', async () => {
204204
it('should build a default installer given a clientID, client secret and stateSecret', async () => {
205205
const installer = new InstallProvider({ clientId, clientSecret, stateSecret, logger: noopLogger });
206206
assert.ok(installer instanceof InstallProvider);
207+
// biome-ignore lint/suspicious/noExplicitAny: accessing private property for test assertion
207208
assert.strictEqual((installer as any).authVersion, 'v2');
208209
});
209210

@@ -216,7 +217,9 @@ describe('InstallProvider', async () => {
216217
clientOptions: webClientOptions,
217218
});
218219
assert.ok(installer instanceof InstallProvider);
220+
// biome-ignore lint/suspicious/noExplicitAny: accessing private property for test assertion
219221
assert.strictEqual((installer as any).authVersion, 'v2');
222+
// biome-ignore lint/suspicious/noExplicitAny: accessing private property for test assertion
220223
assert.strictEqual((installer as any).clientOptions.timeout, webClientOptions.timeout);
221224
});
222225

@@ -251,6 +254,7 @@ describe('InstallProvider', async () => {
251254
logger: noopLogger,
252255
});
253256
assert.ok(installer instanceof InstallProvider);
257+
// biome-ignore lint/suspicious/noExplicitAny: accessing private property for test assertion
254258
assert.strictEqual((installer as any).authVersion, 'v2');
255259
});
256260

@@ -263,6 +267,7 @@ describe('InstallProvider', async () => {
263267
logger: noopLogger,
264268
});
265269
assert.ok(installer instanceof InstallProvider);
270+
// biome-ignore lint/suspicious/noExplicitAny: accessing private property for test assertion
266271
assert.strictEqual((installer as any).authVersion, 'v1');
267272
});
268273

packages/oauth/src/installation-stores/file-store.test.ts

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import os from 'node:os';
44
import { afterEach, beforeEach, describe, it } from 'node:test';
55
import sinon from 'sinon';
66

7+
import type { InstallationQuery } from '../index';
78
import { InstallProvider } from '../index';
89
import { FileInstallationStore } from './index';
910

@@ -79,11 +80,11 @@ describe('FileInstallationStore', async () => {
7980
beforeEach(() => {
8081
// Note that these sinon stubs affect the `os` package behaviors
8182
// in the tests in this file
82-
fsMakeDirSync = sinon.stub(fs, 'mkdirSync').returns({} as any);
83-
fsWriteFileSync = sinon.stub(fs, 'writeFileSync').returns(undefined as any);
83+
fsMakeDirSync = (sinon.stub(fs, 'mkdirSync') as sinon.SinonStub).returns(undefined);
84+
fsWriteFileSync = (sinon.stub(fs, 'writeFileSync') as sinon.SinonStub).returns(undefined);
8485
fsReadFileSync = sinon.stub(fs, 'readFileSync').returns(Buffer.from(JSON.stringify(storedInstallation)));
85-
fsUnlinkSync = sinon.stub(fs, 'unlinkSync').returns(undefined as any);
86-
fsReaddirSync = sinon.stub(fs, 'readdirSync').returns(['app-latest', 'user-userId-latest'] as any);
86+
fsUnlinkSync = (sinon.stub(fs, 'unlinkSync') as sinon.SinonStub).returns(undefined);
87+
fsReaddirSync = (sinon.stub(fs, 'readdirSync') as sinon.SinonStub).returns(['app-latest', 'user-userId-latest']);
8788
});
8889

8990
afterEach(() => {
@@ -117,7 +118,8 @@ describe('FileInstallationStore', async () => {
117118
try {
118119
await installationStore.storeInstallation(storedInstallation);
119120
assert.fail('An exception should be thrown');
120-
} catch (e: any) {
121+
} catch (e: unknown) {
122+
assert.ok(e instanceof Error);
121123
assert.strictEqual(
122124
e.message,
123125
'Failed to save installation to FileInstallationStore (error: Error: The original error message)',
@@ -167,7 +169,8 @@ describe('FileInstallationStore', async () => {
167169
teamId: 'T111',
168170
});
169171
assert.fail(`An exception should be thrown ${JSON.stringify(res)}`);
170-
} catch (e: any) {
172+
} catch (e: unknown) {
173+
assert.ok(e instanceof Error);
171174
assert.strictEqual(
172175
e.message,
173176
'No installation data found (enterprise_id: E999, team_id: T111, user_id: undefined)',
@@ -232,13 +235,13 @@ describe('FileInstallationStore', async () => {
232235
},
233236
};
234237
const installationStore = {
235-
fetchInstallation: (_: any) => {
238+
fetchInstallation: (_: InstallationQuery<boolean>) => {
236239
return new Promise((resolve) => {
237240
resolve(storedInstallation);
238241
});
239242
},
240243
storeInstallation: () => {},
241-
deleteInstallation: (_: any) => {},
244+
deleteInstallation: (_: InstallationQuery<boolean>) => {},
242245
};
243246
const installer = new InstallProvider({ clientId, clientSecret, stateSecret, installationStore });
244247
const authorizeResult = await installer.authorize({ teamId: 'T111' });
@@ -270,13 +273,13 @@ describe('FileInstallationStore', async () => {
270273
user: null,
271274
};
272275
const installationStore = {
273-
fetchInstallation: (_: any) => {
276+
fetchInstallation: (_: InstallationQuery<boolean>) => {
274277
return new Promise((resolve) => {
275278
resolve(storedInstallation);
276279
});
277280
},
278281
storeInstallation: () => {},
279-
deleteInstallation: (_: any) => {},
282+
deleteInstallation: (_: InstallationQuery<boolean>) => {},
280283
};
281284
const installer = new InstallProvider({ clientId, clientSecret, stateSecret, installationStore });
282285
const authorizeResult = await installer.authorize({ teamId: 'T111' });

packages/webhook/src/IncomingWebhook.test.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import assert from 'node:assert/strict';
22
import { afterEach, beforeEach, describe, it } from 'node:test';
33
import nock from 'nock';
44

5+
import type { CodedError } from './errors';
56
import { ErrorCode } from './errors';
67
import { IncomingWebhook } from './IncomingWebhook';
78

@@ -20,12 +21,14 @@ describe('IncomingWebhook', () => {
2021

2122
it('should create a default webhook with a default timeout', () => {
2223
const webhook = new IncomingWebhook(url);
24+
// biome-ignore lint/suspicious/noExplicitAny: accessing private property for test assertion
2325
assert.strictEqual((webhook as any).defaults.timeout, 0);
2426
});
2527

2628
it('should create an axios instance that has the timeout passed by the user', () => {
2729
const givenTimeout = 100;
2830
const webhook = new IncomingWebhook(url, { timeout: givenTimeout });
31+
// biome-ignore lint/suspicious/noExplicitAny: accessing private property for test assertion
2932
assert.strictEqual((webhook as any).axios.defaults.timeout, givenTimeout);
3033
});
3134
});
@@ -94,7 +97,7 @@ describe('IncomingWebhook', () => {
9497
assert.fail('expected rejection');
9598
} catch (error) {
9699
assert.ok(error instanceof Error);
97-
assert.strictEqual((error as any).code, ErrorCode.RequestError);
100+
assert.strictEqual((error as CodedError).code, ErrorCode.RequestError);
98101
}
99102
});
100103
});
@@ -108,6 +111,7 @@ describe('IncomingWebhook', () => {
108111
await webhook.send({ channel: 'different' });
109112
assert.fail('expected rejection');
110113
} catch (_err) {
114+
// biome-ignore lint/suspicious/noExplicitAny: accessing private property for test assertion
111115
assert.strictEqual((webhook as any).defaults.channel, defaultParams.channel);
112116
}
113117
});

0 commit comments

Comments
 (0)