Skip to content

Commit

Permalink
Updating POST /api/engines tests
Browse files Browse the repository at this point in the history
  • Loading branch information
byronhulcher committed Feb 24, 2021
1 parent 1c1cc8e commit 0423d9e
Showing 1 changed file with 50 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -122,19 +122,56 @@ describe('engine routes', () => {
});

describe('validates', () => {
it('correctly', () => {
const request = { body: { name: 'some-engine', language: 'en' } };
mockRouter.shouldValidate(request);
});

it('missing name', () => {
const request = { body: { language: 'en' } };
mockRouter.shouldThrow(request);
});

it('optional language', () => {
const request = { body: { name: 'some-engine' } };
mockRouter.shouldValidate(request);
describe('indexed engines', () => {
it('correctly', () => {
const request = { body: { name: 'some-engine', language: 'en' } };
mockRouter.shouldValidate(request);
});

it('missing name', () => {
const request = { body: { language: 'en' } };
mockRouter.shouldThrow(request);
});

it('optional language', () => {
const request = { body: { name: 'some-engine' } };
mockRouter.shouldValidate(request);
});
});

describe('meta engines', () => {
it('all properties', () => {
const request = {
body: { name: 'some-meta-engine', type: 'any', language: 'en', source_engines: [] },
};
mockRouter.shouldValidate(request);
});

it('missing name', () => {
const request = {
body: { type: 'any', language: 'en', source_engines: [] },
};
mockRouter.shouldThrow(request);
});

it('optional language', () => {
const request = {
body: { name: 'some-meta-engine', type: 'any', source_engines: [] },
};
mockRouter.shouldValidate(request);
});

it('optional source_engines', () => {
const request = {
body: { name: 'some-meta-engine', type: 'any', language: 'en' },
};
mockRouter.shouldValidate(request);
});

it('optional type', () => {
const request = { body: { name: 'some-engine' } };
mockRouter.shouldValidate(request);
});
});
});
});
Expand Down

0 comments on commit 0423d9e

Please sign in to comment.