Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: increase timeout that periodically fails #350

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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));
}
}
}
});
});