Skip to content

Commit

Permalink
Try to fix timeout issues
Browse files Browse the repository at this point in the history
  • Loading branch information
markerikson committed Jun 27, 2022
1 parent 6813fae commit 5b145b2
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions packages/rtk-query-codegen-openapi/test/cli.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ afterEach(() => {

describe('CLI options testing', () => {
test('generation with `config.example.js`', async () => {
jest.setTimeout(10000);

const out = await cli([`./config.example.js`], __dirname);

expect(out).toEqual({
Expand All @@ -46,11 +44,9 @@ Done
});

expect(fs.readFileSync(path.resolve(tmpDir, 'example.ts'), 'utf-8')).toMatchSnapshot();
});
}, 25000);

test('paths are relative to configfile, not to cwd', async () => {
jest.setTimeout(10000);

const out = await cli([`../test/config.example.js`], path.resolve(__dirname, '../src'));

expect(out).toEqual({
Expand All @@ -62,11 +58,9 @@ Done
});

expect(fs.readFileSync(path.resolve(tmpDir, 'example.ts'), 'utf-8')).toMatchSnapshot();
});
}, 25000);

test('ts, js and json all work the same', async () => {
jest.setTimeout(25000);

await cli([`./config.example.js`], __dirname);
const fromJs = fs.readFileSync(path.resolve(tmpDir, 'example.ts'), 'utf-8');
await cli([`./config.example.ts`], __dirname);
Expand All @@ -76,12 +70,10 @@ Done

expect(fromTs).toEqual(fromJs);
expect(fromJson).toEqual(fromJs);
});
}, 25000);

test('missing parameters doesnt fail', async () => {
jest.setTimeout(25000);

const out = await cli([`./config.invalid-example.json`], __dirname);
expect(out.stderr).toContain("Error: path parameter petId does not seem to be defined in '/pet/{petId}'!")
});
expect(out.stderr).toContain("Error: path parameter petId does not seem to be defined in '/pet/{petId}'!");
}, 25000);
});

0 comments on commit 5b145b2

Please sign in to comment.