Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
86277a6
commit f94c0b1
Showing
4 changed files
with
51 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const Sequelize = require('sequelize'); | ||
|
||
const sequelize = new Sequelize({ | ||
dialect: 'mysql', | ||
}); | ||
|
||
const { SchemaManager, OpenApi3Strategy } = require('../../../lib'); | ||
const schemaWrapper = require('./schema-validation-wrapper'); | ||
|
||
describe('OpenAPI v3 strategy', function() { | ||
const manager = new SchemaManager(); | ||
const strategy = new OpenApi3Strategy(); | ||
const userModel = sequelize.import('../../models/user.js').build(); | ||
|
||
const schema = manager.generate(userModel, strategy); | ||
schemaWrapper.components.schemas.users = schema; | ||
|
||
describe('Properties', function() { | ||
it("has a version 3 'openapi' property", function() { | ||
expect(schemaWrapper).toHaveProperty('openapi'); | ||
expect(schemaWrapper.openapi).toMatch(/^3\.\d\.\d/); // 3.n.n | ||
}); | ||
|
||
it("has a non-empty 'schemas' property", function() { | ||
expect(Object.keys(schemaWrapper.components.schemas).length).toBeGreaterThan(0); | ||
}); | ||
}); | ||
|
||
describe('Validation', function() { | ||
it('passes schema validation against xxx', function() { | ||
expect(schemaWrapper).toHaveProperty('openapi'); | ||
expect(schemaWrapper.openapi).toMatch(/^3\.\d\.\d/); // 3.n.n | ||
}); | ||
}); | ||
|
||
// @todo this should be detected by eslint-plugin-jest no-disabled-tests (but is not) | ||
// test('', function() { | ||
// console.log('Does nothing'); | ||
// }); | ||
}); | ||
|
||
/* | ||
describe('foo', () => {}); | ||
*/ |