From 5efd1104910ec4b23aa2b4d4e1e266ce38a29da9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Latzarus?= Date: Sun, 5 May 2024 09:19:48 +0200 Subject: [PATCH] tests(client): use location fixtures in tests --- client/mirage/config.js | 23 +---------------------- client/mirage/fixtures/locations.ts | 12 ++++++++++++ 2 files changed, 13 insertions(+), 22 deletions(-) create mode 100644 client/mirage/fixtures/locations.ts diff --git a/client/mirage/config.js b/client/mirage/config.js index 2d61984..3354d4f 100644 --- a/client/mirage/config.js +++ b/client/mirage/config.js @@ -65,28 +65,7 @@ function routes() { this.patch('/api/ships/:id'); - this.get('/api/locations', () => { - return { - data: [ - { - id: 'earth', - type: 'location', - attributes: { - name: 'Earth', - position: { x: 1, y: 2 }, - }, - }, - { - id: 'moon', - type: 'location', - attributes: { - name: 'Moon', - position: { x: 1, y: 2 }, - }, - }, - ], - }; - }); + this.get('/api/locations'); // These comments are here to help you get started. Feel free to delete them. diff --git a/client/mirage/fixtures/locations.ts b/client/mirage/fixtures/locations.ts new file mode 100644 index 0000000..4a17d76 --- /dev/null +++ b/client/mirage/fixtures/locations.ts @@ -0,0 +1,12 @@ +export default [ + { + id: 'earth', + name: 'Earth', + position: { x: 1, y: 2 }, + }, + { + id: 'moon', + name: 'Moon', + position: { x: 1, y: 2 }, + }, +];