Skip to content

Commit 5b813c8

Browse files
committed
for each file in examples
1 parent 26cd326 commit 5b813c8

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

tests/smoke.spec.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import {OpenAPIN8NParser} from "../src/OpenAPIN8NParser";
2+
import {readdirSync} from 'fs';
3+
import {join} from 'path';
4+
import {sleep} from "n8n-workflow";
25

3-
test('petstore.json', async () => {
4-
const doc = require('./examples/petstore.json');
5-
const parser = new OpenAPIN8NParser(doc);
6-
parser.process()
7-
})
6+
// Define the path to your 'examples' directory
7+
const examplesDir = join(__dirname, 'examples');
88

9+
// Read all JSON files from the examples directory
10+
const jsonFiles = readdirSync(examplesDir).filter(file => file.endsWith('.json'));
911

10-
test('waha.json', async () => {
11-
const doc = require('./examples/waha.json');
12-
const parser = new OpenAPIN8NParser(doc);
13-
parser.process()
14-
})
15-
16-
test('chatwoot.json', () => {
17-
const doc = require('./examples/chatwoot.json');
18-
const parser = new OpenAPIN8NParser(doc);
19-
parser.process()
20-
})
12+
describe('smoke', () => {
13+
test.each(jsonFiles)('%s', async (fileName) => {
14+
const filePath = join(examplesDir, fileName);
15+
const doc = require(filePath);
16+
const parser = new OpenAPIN8NParser(doc);
17+
parser.process();
18+
await sleep(50) // wait for logs a bit
19+
});
20+
});

0 commit comments

Comments
 (0)