Skip to content

Commit 88d492e

Browse files
committed
fix(plugin-typescript): refined tests
1 parent 322a453 commit 88d492e

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

packages/plugin-typescript/src/lib/runner/runner.unit.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe('createRunnerFunction', () => {
1414
runnerModule,
1515
'getTypeScriptDiagnostics',
1616
);
17-
const tSCodeToAuditSlugSpy = vi.spyOn(utilsModule, 'tSCodeToAuditSlug');
17+
const tSCodeToAuditSlugSpy = vi.spyOn(utilsModule, 'tsCodeToAuditSlug');
1818
const getIssueFromDiagnosticSpy = vi.spyOn(
1919
utilsModule,
2020
'getIssueFromDiagnostic',
@@ -50,7 +50,7 @@ describe('createRunnerFunction', () => {
5050
it('should return empty array if no diagnostics are found', async () => {
5151
getTypeScriptDiagnosticsSpy.mockResolvedValue([]);
5252
const runner = createRunnerFunction({
53-
tsConfigPath: 'tsconfig.json',
53+
tsconfig: 'tsconfig.json',
5454
expectedAudits: [],
5555
});
5656
await expect(runner(() => void 0)).resolves.toStrictEqual([]);
@@ -59,7 +59,7 @@ describe('createRunnerFunction', () => {
5959
it('should return empty array if no supported diagnostics are found', async () => {
6060
getTypeScriptDiagnosticsSpy.mockResolvedValue([mockSemanticDiagnostic]);
6161
const runner = createRunnerFunction({
62-
tsConfigPath: 'tsconfig.json',
62+
tsconfig: 'tsconfig.json',
6363
expectedAudits: [],
6464
});
6565
await expect(runner(() => void 0)).resolves.toStrictEqual([]);
@@ -68,7 +68,7 @@ describe('createRunnerFunction', () => {
6868
it('should pass the diagnostic code to tsCodeToSlug', async () => {
6969
getTypeScriptDiagnosticsSpy.mockResolvedValue([mockSemanticDiagnostic]);
7070
const runner = createRunnerFunction({
71-
tsConfigPath: 'tsconfig.json',
71+
tsconfig: 'tsconfig.json',
7272
expectedAudits: [],
7373
});
7474
await expect(runner(() => void 0)).resolves.toStrictEqual([]);
@@ -79,7 +79,7 @@ describe('createRunnerFunction', () => {
7979
it('should pass the diagnostic to getIssueFromDiagnostic', async () => {
8080
getTypeScriptDiagnosticsSpy.mockResolvedValue([mockSemanticDiagnostic]);
8181
const runner = createRunnerFunction({
82-
tsConfigPath: 'tsconfig.json',
82+
tsconfig: 'tsconfig.json',
8383
expectedAudits: [],
8484
});
8585
await expect(runner(() => void 0)).resolves.toStrictEqual([]);
@@ -100,7 +100,7 @@ describe('createRunnerFunction', () => {
100100
},
101101
]);
102102
const runner = createRunnerFunction({
103-
tsConfigPath: 'tsconfig.json',
103+
tsconfig: 'tsconfig.json',
104104
expectedAudits: [{ slug: 'semantic-errors' }],
105105
});
106106

@@ -131,7 +131,7 @@ describe('createRunnerFunction', () => {
131131
mockSemanticDiagnostic,
132132
]);
133133
const runner = createRunnerFunction({
134-
tsConfigPath: 'tsconfig.json',
134+
tsconfig: 'tsconfig.json',
135135
expectedAudits: [{ slug: 'semantic-errors' }, { slug: 'syntax-errors' }],
136136
});
137137

@@ -174,7 +174,7 @@ describe('createRunnerFunction', () => {
174174
},
175175
]);
176176
const runner = createRunnerFunction({
177-
tsConfigPath: 'tsconfig.json',
177+
tsconfig: 'tsconfig.json',
178178
expectedAudits: [{ slug: 'semantic-errors' }, { slug: 'syntax-errors' }],
179179
});
180180
const auditOutputs = await runner(() => void 0);

packages/plugin-typescript/src/lib/runner/utils.unit.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@ import { beforeEach, describe, expect } from 'vitest';
33
import {
44
getIssueFromDiagnostic,
55
getSeverity,
6-
tSCodeToAuditSlug,
6+
tsCodeToAuditSlug,
77
} from './utils.js';
88

99
describe('tSCodeToAuditSlug', () => {
1010
it('should transform supported code to readable audit', () => {
11-
expect(tSCodeToAuditSlug(Number.parseInt('2345', 10))).toBe(
11+
expect(tsCodeToAuditSlug(Number.parseInt('2345', 10))).toBe(
1212
'semantic-errors',
1313
);
1414
});
1515

1616
it('should return unknown slug for unknown code', () => {
17-
expect(tSCodeToAuditSlug(999)).toBe('unknown-codes');
17+
expect(tsCodeToAuditSlug(999)).toBe('unknown-codes');
1818
});
1919
});
2020

0 commit comments

Comments
 (0)