Skip to content

Commit

Permalink
test: increase timeout that periodically fails (#350)
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaslagoni authored Mar 13, 2023
1 parent ca7b444 commit 26acf98
Showing 1 changed file with 24 additions and 22 deletions.
46 changes: 24 additions & 22 deletions test/schemas.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,29 @@ const versionsToTest = [
version: '3.0.0'
}
]

it('Versions should accurately validate documents', () => {
for (const versionToTest of versionsToTest) {
const version = versionToTest.version;
const asyncapi = require('..');
const schema = asyncapi[version];
delete schema.definitions['http://json-schema.org/draft-07/schema'];
const ajv = new Ajv({
jsonPointers: true,
allErrors: true,
schemaId: '$id',
logger: false,
validateFormats: false,
strict: false
});
const documentPaths = fs.readdirSync(path.resolve(__dirname, `./docs/${version}`)).map((pathToDoc) => {return path.resolve(__dirname, `./docs/${version}/${pathToDoc}`)});
for (const documentPath of documentPaths) {
const document = require(documentPath);
const validate = ajv.compile(schema)
const valid = validate(document)
assert(valid === true, 'Document must be validated correctly: ' + JSON.stringify(validate.errors, null, 4));
describe("Should be able to validate", function () {
this.timeout(30000);
it('all valid documents', () => {
for (const versionToTest of versionsToTest) {
const version = versionToTest.version;
const asyncapi = require('..');
const schema = asyncapi[version];
delete schema.definitions['http://json-schema.org/draft-07/schema'];
const ajv = new Ajv({
jsonPointers: true,
allErrors: true,
schemaId: '$id',
logger: false,
validateFormats: false,
strict: false
});
const documentPaths = fs.readdirSync(path.resolve(__dirname, `./docs/${version}`)).map((pathToDoc) => {return path.resolve(__dirname, `./docs/${version}/${pathToDoc}`)});
for (const documentPath of documentPaths) {
const document = require(documentPath);
const validate = ajv.compile(schema)
const valid = validate(document)
assert(valid === true, 'Document must be validated correctly: ' + JSON.stringify(validate.errors, null, 4));
}
}
}
});
});

0 comments on commit 26acf98

Please sign in to comment.