diff --git a/test/cardService.test.ts b/test/cardService.test.ts new file mode 100644 index 0000000..06b82bf --- /dev/null +++ b/test/cardService.test.ts @@ -0,0 +1,25 @@ +import { findCardByID, findCardsByQueries, getAllCards } from '../src/services/cardService'; +import { Query } from "../src/interfaces/query"; +import { Card } from "../src/interfaces/card"; + +describe('Card Service', () => { + it('should get a single card using query parameters', async () => { + const params: Query[] = [{ + name: 'id', + value: 'xy7-54' + }] + + const result: Card[] = await findCardsByQueries(params); + expect(result[0].name).toEqual('Gardevoir'); + }) + + it('should get a single card using a card id', async () => { + const result: Card = await findCardByID('xy7-54'); + expect(result.name).toEqual('Gardevoir'); + }) + + it('should get a default list of cards using the cards resource with no query params', async () => { + const results: Card[] = await getAllCards(); + expect(results).toHaveLength(250); + }); +}) \ No newline at end of file