mirror of
https://github.com/Redocly/redoc.git
synced 2025-03-13 06:15:46 +03:00
Migrate tests to jasmine instead of macha (angular testing depends on jasmine)
This commit is contained in:
parent
832d018c1b
commit
36c51dee3d
|
@ -3,7 +3,7 @@
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
"env": {
|
"env": {
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"mocha": true
|
"jasmine": true
|
||||||
},
|
},
|
||||||
// currently eslint doesn't support extension-typed configs
|
// currently eslint doesn't support extension-typed configs
|
||||||
"globals": {
|
"globals": {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
module.exports = function (config) {
|
module.exports = function (config) {
|
||||||
var travis = process.env.TRAVIS;
|
var travis = process.env.TRAVIS;
|
||||||
config.set({
|
config.set({
|
||||||
frameworks: ['phantomjs-shim', 'jspm', 'mocha', 'chai', 'sinon'],
|
frameworks: ['phantomjs-shim', 'jspm', 'jasmine', 'sinon', 'should'],
|
||||||
preprocessors: {
|
preprocessors: {
|
||||||
'lib/**/!(*spec).js': ['babel', 'coverage']
|
'lib/**/!(*spec).js': ['babel', 'coverage']
|
||||||
},
|
},
|
||||||
|
@ -46,8 +46,8 @@ module.exports = function (config) {
|
||||||
|
|
||||||
jspm: {
|
jspm: {
|
||||||
config: 'system.config.js',
|
config: 'system.config.js',
|
||||||
loadFiles: ['tests/**/*.spec.js', 'lib/**/*.js'],
|
loadFiles: ['tests/**/*.spec.js', 'tests/helpers.js', 'lib/**/*.js'],
|
||||||
serveFiles: ['tests/schemas/**/*.json'],
|
serveFiles: ['tests/schemas/**/*.json', 'lib/**/*.{html,css}'],
|
||||||
nocache: true
|
nocache: true
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ describe('BaseComponent', () => {
|
||||||
let schemaMgr;
|
let schemaMgr;
|
||||||
let component;
|
let component;
|
||||||
|
|
||||||
before(() => {
|
beforeAll(() => {
|
||||||
schemaMgr = new SchemaManager();
|
schemaMgr = new SchemaManager();
|
||||||
schemaMgr._schema = {tags: []};
|
schemaMgr._schema = {tags: []};
|
||||||
});
|
});
|
||||||
|
@ -18,8 +18,8 @@ describe('BaseComponent', () => {
|
||||||
|
|
||||||
it('should set instance properties', () => {
|
it('should set instance properties', () => {
|
||||||
component.schemaMgr.should.be.equal(schemaMgr);
|
component.schemaMgr.should.be.equal(schemaMgr);
|
||||||
component.schema.should.be.an('object');
|
component.schema.should.be.of.type('object');
|
||||||
expect(component.componentSchema).to.not.exist;
|
expect(component.componentSchema).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set componentSchema based on pointer on ngOnInit', () => {
|
it('should set componentSchema based on pointer on ngOnInit', () => {
|
||||||
|
@ -37,13 +37,15 @@ describe('BaseComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('dereference', () => {
|
describe('dereference', () => {
|
||||||
before(() => {
|
beforeAll((done) => {
|
||||||
return schemaMgr.load('/tests/schemas/base-component-dereference.json');
|
schemaMgr.load('/tests/schemas/base-component-dereference.json').then(
|
||||||
|
() => done()
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('simple dereference', () => {
|
describe('simple dereference', () => {
|
||||||
let paramWithRef;
|
let paramWithRef;
|
||||||
before(() => {
|
beforeAll(() => {
|
||||||
component.pointer = '/paths/test1/get';
|
component.pointer = '/paths/test1/get';
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
component.dereference();
|
component.dereference();
|
||||||
|
@ -51,7 +53,7 @@ describe('BaseComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not contain $ref property', () => {
|
it('should not contain $ref property', () => {
|
||||||
expect(paramWithRef.$ref).to.not.exist;
|
expect(paramWithRef.$ref).toBeUndefined();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should inject Title if not exist based on reference', () => {
|
it('should inject Title if not exist based on reference', () => {
|
||||||
|
@ -65,13 +67,13 @@ describe('BaseComponent', () => {
|
||||||
it('should insert correct definition instead of reference', () => {
|
it('should insert correct definition instead of reference', () => {
|
||||||
delete paramWithRef.title;
|
delete paramWithRef.title;
|
||||||
delete paramWithRef._pointer;
|
delete paramWithRef._pointer;
|
||||||
paramWithRef.should.be.deep.equal(schemaMgr.schema.definitions.Simple);
|
paramWithRef.should.be.deepEqual(schemaMgr.schema.definitions.Simple);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('nested dereference', () => {
|
describe('nested dereference', () => {
|
||||||
let paramWithRef;
|
let paramWithRef;
|
||||||
before(() => {
|
beforeAll(() => {
|
||||||
component.pointer = '/paths/test2/get';
|
component.pointer = '/paths/test2/get';
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
component.dereference();
|
component.dereference();
|
||||||
|
@ -83,7 +85,7 @@ describe('BaseComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should resolve nested schema', () => {
|
it('should resolve nested schema', () => {
|
||||||
expect(paramWithRef.properties.subschema.$ref).to.not.exist;
|
expect(paramWithRef.properties.subschema.$ref).toBeUndefined();
|
||||||
paramWithRef._pointer.should.be.equal('#/definitions/Nested');
|
paramWithRef._pointer.should.be.equal('#/definitions/Nested');
|
||||||
paramWithRef.properties.subschema._pointer.should.be.equal('#/definitions/Simple');
|
paramWithRef.properties.subschema._pointer.should.be.equal('#/definitions/Simple');
|
||||||
paramWithRef.properties.subschema.type.should.be.equal('object');
|
paramWithRef.properties.subschema.type.should.be.equal('object');
|
||||||
|
@ -92,7 +94,7 @@ describe('BaseComponent', () => {
|
||||||
|
|
||||||
describe('array schema dereference', () => {
|
describe('array schema dereference', () => {
|
||||||
let paramWithRef;
|
let paramWithRef;
|
||||||
before(() => {
|
beforeAll(() => {
|
||||||
component.pointer = '/paths/test3/get';
|
component.pointer = '/paths/test3/get';
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
component.dereference();
|
component.dereference();
|
||||||
|
@ -100,8 +102,8 @@ describe('BaseComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should resolve array schema', () => {
|
it('should resolve array schema', () => {
|
||||||
expect(paramWithRef.$ref).to.not.exist;
|
expect(paramWithRef.$ref).toBeUndefined();
|
||||||
expect(paramWithRef.items.schema.$ref).to.not.exist;
|
expect(paramWithRef.items.schema.$ref).toBeUndefined();
|
||||||
paramWithRef.type.should.be.equal('array');
|
paramWithRef.type.should.be.equal('array');
|
||||||
paramWithRef._pointer.should.be.equal('#/definitions/ArrayOfSimple');
|
paramWithRef._pointer.should.be.equal('#/definitions/ArrayOfSimple');
|
||||||
paramWithRef.items.schema._pointer.should.be.equal('#/definitions/Simple');
|
paramWithRef.items.schema._pointer.should.be.equal('#/definitions/Simple');
|
||||||
|
@ -111,13 +113,13 @@ describe('BaseComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('mergeAllOf', () => {
|
describe('mergeAllOf', () => {
|
||||||
before(() => {
|
beforeAll((done) => {
|
||||||
return schemaMgr.load('tests/schemas/base-component-joinallof.json');
|
schemaMgr.load('tests/schemas/base-component-joinallof.json').then(() => done());
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Simple allOf merge', () => {
|
describe('Simple allOf merge', () => {
|
||||||
let joined;
|
let joined;
|
||||||
before(() => {
|
beforeAll(() => {
|
||||||
component.pointer = '/definitions/SimpleAllOf';
|
component.pointer = '/definitions/SimpleAllOf';
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
component.dereference();
|
component.dereference();
|
||||||
|
@ -126,7 +128,7 @@ describe('BaseComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should remove $allOf field', () => {
|
it('should remove $allOf field', () => {
|
||||||
expect(joined.allOf).to.not.exist;
|
expect(joined.allOf).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set type object', () => {
|
it('should set type object', () => {
|
||||||
|
@ -135,18 +137,18 @@ describe('BaseComponent', () => {
|
||||||
|
|
||||||
it('should merge properties', () => {
|
it('should merge properties', () => {
|
||||||
Object.keys(joined.properties).length.should.be.equal(3);
|
Object.keys(joined.properties).length.should.be.equal(3);
|
||||||
Object.keys(joined.properties).should.be.deep.equal(['prop1', 'prop2', 'prop3']);
|
Object.keys(joined.properties).should.be.deepEqual(['prop1', 'prop2', 'prop3']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should merge required', () => {
|
it('should merge required', () => {
|
||||||
joined.required.length.should.be.equal(2);
|
joined.required.length.should.be.equal(2);
|
||||||
joined.required.should.be.deep.equal(['prop1', 'prop3']);
|
joined.required.should.be.deepEqual(['prop1', 'prop3']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('AllOf with refrence', () => {
|
describe('AllOf with refrence', () => {
|
||||||
let joined;
|
let joined;
|
||||||
before(() => {
|
beforeAll(() => {
|
||||||
component.pointer = '/definitions/AllOfWithRef';
|
component.pointer = '/definitions/AllOfWithRef';
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
component.dereference();
|
component.dereference();
|
||||||
|
@ -155,7 +157,7 @@ describe('BaseComponent', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should remove $allOf field', () => {
|
it('should remove $allOf field', () => {
|
||||||
expect(joined.allOf).to.not.exist;
|
expect(joined.allOf).toBeNull();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should set type object', () => {
|
it('should set type object', () => {
|
||||||
|
@ -164,12 +166,12 @@ describe('BaseComponent', () => {
|
||||||
|
|
||||||
it('should merge properties', () => {
|
it('should merge properties', () => {
|
||||||
Object.keys(joined.properties).length.should.be.equal(2);
|
Object.keys(joined.properties).length.should.be.equal(2);
|
||||||
Object.keys(joined.properties).should.be.deep.equal(['id', 'prop3']);
|
Object.keys(joined.properties).should.be.deepEqual(['id', 'prop3']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should merge required', () => {
|
it('should merge required', () => {
|
||||||
joined.required.length.should.be.equal(2);
|
joined.required.length.should.be.equal(2);
|
||||||
joined.required.should.be.deep.equal(['id', 'prop3']);
|
joined.required.should.be.deepEqual(['id', 'prop3']);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -178,18 +180,18 @@ describe('BaseComponent', () => {
|
||||||
component.pointer = '/definitions/BadAllOf2';
|
component.pointer = '/definitions/BadAllOf2';
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
component.dereference();
|
component.dereference();
|
||||||
component.joinAllOf.bind(component).should.throw();
|
(() => component.joinAllOf()).should.throw();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should throw when merging non-object schemas', () => {
|
it('should throw when merging non-object schemas', () => {
|
||||||
component.pointer = '/definitions/BadAllOf1';
|
component.pointer = '/definitions/BadAllOf1';
|
||||||
component.ngOnInit();
|
component.ngOnInit();
|
||||||
component.dereference();
|
component.dereference();
|
||||||
component.joinAllOf.bind(component).should.throw();
|
(() => component.joinAllOf()).should.throw();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe.skip('Merge array allOf', () => {
|
xdescribe('Merge array allOf', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
export function statusCodeType(statusCode) {
|
export function statusCodeType(statusCode) {
|
||||||
if (statusCode < 100 || statusCode > 599) {
|
if (statusCode < 100 || statusCode > 599) {
|
||||||
throw 'invalid HTTP code';
|
throw new Error('invalid HTTP code');
|
||||||
}
|
}
|
||||||
let res = 'success';
|
let res = 'success';
|
||||||
if (statusCode >= 300 && statusCode < 400) {
|
if (statusCode >= 300 && statusCode < 400) {
|
||||||
|
|
11
package.json
11
package.json
|
@ -54,7 +54,6 @@
|
||||||
"babel-eslint": "^4.1.3",
|
"babel-eslint": "^4.1.3",
|
||||||
"babel-polyfill": "^6.3.14",
|
"babel-polyfill": "^6.3.14",
|
||||||
"browser-sync": "^2.9.8",
|
"browser-sync": "^2.9.8",
|
||||||
"chai": "^3.4.1",
|
|
||||||
"del": "^2.0.2",
|
"del": "^2.0.2",
|
||||||
"gulp": "^3.9.0",
|
"gulp": "^3.9.0",
|
||||||
"gulp-concat": "^2.6.0",
|
"gulp-concat": "^2.6.0",
|
||||||
|
@ -66,28 +65,30 @@
|
||||||
"gulp-sourcemaps": "^1.6.0",
|
"gulp-sourcemaps": "^1.6.0",
|
||||||
"isparta": "^4.0.0",
|
"isparta": "^4.0.0",
|
||||||
"istanbul": "github:gotwarlost/istanbul#source-map",
|
"istanbul": "github:gotwarlost/istanbul#source-map",
|
||||||
|
"jasmine-core": "^2.4.1",
|
||||||
"jshint-stylish": "^2.0.1",
|
"jshint-stylish": "^2.0.1",
|
||||||
"jspm": "^0.16.11",
|
"jspm": "^0.16.11",
|
||||||
"karma": "^0.13.15",
|
"karma": "^0.13.15",
|
||||||
"karma-babel-preprocessor": "^5.2.2",
|
"karma-babel-preprocessor": "^5.2.2",
|
||||||
"karma-chai": "github:randing89/karma-chai",
|
|
||||||
"karma-chrome-launcher": "^0.2.2",
|
"karma-chrome-launcher": "^0.2.2",
|
||||||
"karma-coverage": "github:douglasduteil/karma-coverage#next",
|
"karma-coverage": "github:douglasduteil/karma-coverage#next",
|
||||||
"karma-coveralls": "^1.1.2",
|
"karma-coveralls": "^1.1.2",
|
||||||
|
"karma-jasmine": "^0.3.6",
|
||||||
"karma-jspm": "^2.0.2",
|
"karma-jspm": "^2.0.2",
|
||||||
"karma-mocha": "^0.2.1",
|
|
||||||
"karma-mocha-reporter": "^1.1.3",
|
"karma-mocha-reporter": "^1.1.3",
|
||||||
"karma-phantomjs-launcher": "^0.2.1",
|
"karma-phantomjs-launcher": "^0.2.1",
|
||||||
"karma-phantomjs-shim": "^1.1.2",
|
"karma-phantomjs-shim": "^1.1.2",
|
||||||
|
"karma-should": "^1.0.0",
|
||||||
"karma-sinon": "^1.0.4",
|
"karma-sinon": "^1.0.4",
|
||||||
"mocha": "^2.3.4",
|
|
||||||
"phantomjs": "^1.9.19",
|
"phantomjs": "^1.9.19",
|
||||||
"reflect-metadata": "^0.1.2",
|
"reflect-metadata": "^0.1.2",
|
||||||
"require-dir": "^0.3.0",
|
"require-dir": "^0.3.0",
|
||||||
"run-sequence": "^1.1.4",
|
"run-sequence": "^1.1.4",
|
||||||
|
"should": "^8.0.1",
|
||||||
"sinon": "^1.9.0",
|
"sinon": "^1.9.0",
|
||||||
"systemjs-builder": "^0.14.7",
|
"systemjs-builder": "^0.14.7",
|
||||||
"vinyl-paths": "^2.0.0",
|
"vinyl-paths": "^2.0.0",
|
||||||
"zone.js": "^0.5.8"
|
"zone.js": "^0.5.8"
|
||||||
}
|
},
|
||||||
|
"dependencies": {}
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ describe('JsonPointer', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should handle relative pointers (starting with #) without errors', ()=> {
|
it('should handle relative pointers (starting with #) without errors', ()=> {
|
||||||
JsonPointer.parse('#/level1/level2/name').should.be.deep.equal(['level1', 'level2', 'name']);
|
JsonPointer.parse('#/level1/level2/name').should.be.deepEqual(['level1', 'level2', 'name']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should join correctly', ()=> {
|
it('should join correctly', ()=> {
|
||||||
|
|
|
@ -38,7 +38,7 @@ describe('Schema manager', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Schema manager basic functionality', ()=> {
|
describe('Schema manager basic functionality', ()=> {
|
||||||
before(function (done) {
|
beforeAll(function (done) {
|
||||||
schemaMgr.load('/tests/schemas/extended-petstore.json').then(() => {
|
schemaMgr.load('/tests/schemas/extended-petstore.json').then(() => {
|
||||||
done();
|
done();
|
||||||
}, () => {
|
}, () => {
|
||||||
|
@ -48,7 +48,7 @@ describe('Schema manager', () => {
|
||||||
|
|
||||||
|
|
||||||
it('should contain non-empty schema', ()=> {
|
it('should contain non-empty schema', ()=> {
|
||||||
schemaMgr.schema.should.be.an('object');
|
schemaMgr.schema.should.be.an.Object();
|
||||||
schemaMgr.schema.should.be.not.empty;
|
schemaMgr.schema.should.be.not.empty;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -59,19 +59,19 @@ describe('Schema manager', () => {
|
||||||
describe('byPointer method', () => {
|
describe('byPointer method', () => {
|
||||||
it('should return correct schema part', ()=> {
|
it('should return correct schema part', ()=> {
|
||||||
let part = schemaMgr.byPointer('/tags/3');
|
let part = schemaMgr.byPointer('/tags/3');
|
||||||
part.should.be.deep.equal(schemaMgr.schema.tags[3]);
|
part.should.be.deepEqual(schemaMgr.schema.tags[3]);
|
||||||
part.should.be.equal(schemaMgr.schema.tags[3]);
|
part.should.be.equal(schemaMgr.schema.tags[3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return null for incorrect pointer', ()=> {
|
it('should return null for incorrect pointer', ()=> {
|
||||||
let part = schemaMgr.byPointer('/incorrect/pointer');
|
let part = schemaMgr.byPointer('/incorrect/pointer');
|
||||||
should.not.exist(part);
|
expect(part).toBeNull();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getTagsMap method', () => {
|
describe('getTagsMap method', () => {
|
||||||
before(function () {
|
beforeAll(function () {
|
||||||
schemaMgr._schema = {
|
schemaMgr._schema = {
|
||||||
tags: [
|
tags: [
|
||||||
{name: 'tag1', description: 'info1'},
|
{name: 'tag1', description: 'info1'},
|
||||||
|
@ -86,7 +86,7 @@ describe('Schema manager', () => {
|
||||||
tag1: {description: 'info1', 'x-traitTag': false},
|
tag1: {description: 'info1', 'x-traitTag': false},
|
||||||
tag2: {description: 'info2', 'x-traitTag': true}
|
tag2: {description: 'info2', 'x-traitTag': true}
|
||||||
};
|
};
|
||||||
tagsMap.should.be.deep.equal(expectedResult);
|
tagsMap.should.be.deepEqual(expectedResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should return empty array for non-specified tags', () => {
|
it('should return empty array for non-specified tags', () => {
|
||||||
|
@ -123,7 +123,7 @@ describe('Schema manager', () => {
|
||||||
let menuTree;
|
let menuTree;
|
||||||
let entries;
|
let entries;
|
||||||
|
|
||||||
before(() => {
|
beforeAll(() => {
|
||||||
schemaMgr._schema = suitSchema;
|
schemaMgr._schema = suitSchema;
|
||||||
menuTree = schemaMgr.buildMenuTree();
|
menuTree = schemaMgr.buildMenuTree();
|
||||||
entries = Array.from(menuTree.entries());
|
entries = Array.from(menuTree.entries());
|
||||||
|
@ -161,12 +161,12 @@ describe('Schema manager', () => {
|
||||||
it('methods for tag should contain valid pointer and summary', () => {
|
it('methods for tag should contain valid pointer and summary', () => {
|
||||||
for (let entr of entries) {
|
for (let entr of entries) {
|
||||||
let [, info] = entr;
|
let [, info] = entr;
|
||||||
info.should.be.an('object');
|
info.should.be.an.Object();
|
||||||
info.methods.should.be.an('array');
|
info.methods.should.be.an.Array();
|
||||||
for (let methodInfo of info.methods) {
|
for (let methodInfo of info.methods) {
|
||||||
methodInfo.should.include.keys('pointer', 'summary');
|
methodInfo.should.have.keys('pointer', 'summary');
|
||||||
let methSchema = schemaMgr.byPointer(methodInfo.pointer);
|
let methSchema = schemaMgr.byPointer(methodInfo.pointer);
|
||||||
should.exist(methSchema);
|
expect(methSchema).not.toBeNull();
|
||||||
if (methSchema.summary) {
|
if (methSchema.summary) {
|
||||||
methSchema.summary.should.be.equal(methodInfo.summary);
|
methSchema.summary.should.be.equal(methodInfo.summary);
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ describe('Schema manager', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('getMethodParams method', () => {
|
describe('getMethodParams method', () => {
|
||||||
before((done) => {
|
beforeAll((done) => {
|
||||||
schemaMgr.load('/tests/schemas/schema-mgr-methodparams.json').then(() => {
|
schemaMgr.load('/tests/schemas/schema-mgr-methodparams.json').then(() => {
|
||||||
done();
|
done();
|
||||||
}, () => {
|
}, () => {
|
||||||
|
@ -199,7 +199,7 @@ describe('Schema manager', () => {
|
||||||
|
|
||||||
it('should accept pointer directly to parameters', () => {
|
it('should accept pointer directly to parameters', () => {
|
||||||
let params = schemaMgr.getMethodParams('/paths/test1/get/parameters', true);
|
let params = schemaMgr.getMethodParams('/paths/test1/get/parameters', true);
|
||||||
expect(params).to.exist;
|
expect(params).not.toBeNull();
|
||||||
params.length.should.be.equal(2);
|
params.length.should.be.equal(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ describe('Schema manager', () => {
|
||||||
|
|
||||||
it('should throw for parameters other than array', () => {
|
it('should throw for parameters other than array', () => {
|
||||||
let func = () => schemaMgr.getMethodParams('/paths/test4/get', true);
|
let func = () => schemaMgr.getMethodParams('/paths/test4/get', true);
|
||||||
func.should.throw();
|
expect(func).toThrow();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,7 @@ describe('KeysPipe and ValuesPipe', () => {
|
||||||
describe('KeysPipe transform', () => {
|
describe('KeysPipe transform', () => {
|
||||||
it('should return keys', () => {
|
it('should return keys', () => {
|
||||||
var val = keysPipe.transform(obj);
|
var val = keysPipe.transform(obj);
|
||||||
val.should.be.deep.equal(['a', 'b', 'c']);
|
val.should.be.deepEqual(['a', 'b', 'c']);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not support other objects', () => {
|
it('should not support other objects', () => {
|
||||||
|
@ -35,7 +35,7 @@ describe('KeysPipe and ValuesPipe', () => {
|
||||||
describe('KeysPipe transform', () => {
|
describe('KeysPipe transform', () => {
|
||||||
it('should return values', () => {
|
it('should return values', () => {
|
||||||
var val = valuesPipe.transform(obj);
|
var val = valuesPipe.transform(obj);
|
||||||
val.should.be.deep.equal([1, 2, 3]);
|
val.should.be.deepEqual([1, 2, 3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should not support other objects', () => {
|
it('should not support other objects', () => {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user