Skip to content

Commit 80f67f2

Browse files
committed
test: add test for duplicate plugin warning
1 parent 4bc269f commit 80f67f2

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

packages/openapi-ts/src/__tests__/index.test.ts

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,32 @@ describe('createClient', () => {
286286
expect(results).toHaveLength(4);
287287
});
288288

289+
it('warns when duplicate plugins are specified', async () => {
290+
const warnSpy = vi.spyOn(console, 'warn').mockImplementation(() => {});
291+
292+
await createClient({
293+
dryRun: true,
294+
input: {
295+
info: { title: 'duplicate-plugin-test', version: '1.0.0' },
296+
openapi: '3.1.0',
297+
},
298+
logs: {
299+
level: 'silent',
300+
},
301+
output: 'output',
302+
plugins: [
303+
{ name: '@hey-api/typescript' },
304+
{ name: '@hey-api/typescript' },
305+
],
306+
});
307+
308+
expect(warnSpy).toHaveBeenCalledWith(
309+
expect.stringContaining('Duplicate plugin'),
310+
);
311+
312+
warnSpy.mockRestore();
313+
});
314+
289315
it('executes @angular/common HttpRequest builder path', async () => {
290316
const results = await createClient({
291317
dryRun: true,

0 commit comments

Comments
 (0)