Skip to content

Commit 26acf98

Browse files
authored
test: increase timeout that periodically fails (#350)
1 parent ca7b444 commit 26acf98

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

test/schemas.js

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,29 @@ const versionsToTest = [
77
version: '3.0.0'
88
}
99
]
10-
11-
it('Versions should accurately validate documents', () => {
12-
for (const versionToTest of versionsToTest) {
13-
const version = versionToTest.version;
14-
const asyncapi = require('..');
15-
const schema = asyncapi[version];
16-
delete schema.definitions['http://json-schema.org/draft-07/schema'];
17-
const ajv = new Ajv({
18-
jsonPointers: true,
19-
allErrors: true,
20-
schemaId: '$id',
21-
logger: false,
22-
validateFormats: false,
23-
strict: false
24-
});
25-
const documentPaths = fs.readdirSync(path.resolve(__dirname, `./docs/${version}`)).map((pathToDoc) => {return path.resolve(__dirname, `./docs/${version}/${pathToDoc}`)});
26-
for (const documentPath of documentPaths) {
27-
const document = require(documentPath);
28-
const validate = ajv.compile(schema)
29-
const valid = validate(document)
30-
assert(valid === true, 'Document must be validated correctly: ' + JSON.stringify(validate.errors, null, 4));
10+
describe("Should be able to validate", function () {
11+
this.timeout(30000);
12+
it('all valid documents', () => {
13+
for (const versionToTest of versionsToTest) {
14+
const version = versionToTest.version;
15+
const asyncapi = require('..');
16+
const schema = asyncapi[version];
17+
delete schema.definitions['http://json-schema.org/draft-07/schema'];
18+
const ajv = new Ajv({
19+
jsonPointers: true,
20+
allErrors: true,
21+
schemaId: '$id',
22+
logger: false,
23+
validateFormats: false,
24+
strict: false
25+
});
26+
const documentPaths = fs.readdirSync(path.resolve(__dirname, `./docs/${version}`)).map((pathToDoc) => {return path.resolve(__dirname, `./docs/${version}/${pathToDoc}`)});
27+
for (const documentPath of documentPaths) {
28+
const document = require(documentPath);
29+
const validate = ajv.compile(schema)
30+
const valid = validate(document)
31+
assert(valid === true, 'Document must be validated correctly: ' + JSON.stringify(validate.errors, null, 4));
32+
}
3133
}
32-
}
34+
});
3335
});

0 commit comments

Comments
 (0)