Add Set Service test

This commit is contained in:
Tee
2021-03-11 19:27:04 -05:00
parent 735d428dc2
commit 32e6de135e

25
test/setService.test.ts Normal file
View File

@ -0,0 +1,25 @@
import { findSetByID, findSetsByQueries, getAllSets } from '../src/services/setService';
import { Query } from "../src/interfaces/query";
import { Set } from "../src/interfaces/set";
describe('Set Service', () => {
it('should get a single set using query parameters', async () => {
const params: Query[] = [{
name: 'name',
value: 'Base'
}];
const result: Set[] = await findSetsByQueries(params);
expect(result[0].name).toEqual('Base');
})
it('should get a single set using a set id', async () => {
const result: Set = await findSetByID('base1');
expect(result.name).toEqual('Base');
})
it('should get a default list of sets using the sets resource with no query params', async () => {
const results: Set[] = await getAllSets();
expect(results.length).toBeLessThanOrEqual(250);
});
})