From 5936c2b743b450caa5d2990242023f0a059fe747 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Sun, 6 Apr 2025 09:57:03 -0700 Subject: [PATCH] update tests to match new repository behavior --- ...izedInMemoryShuttleRepositoryTests.test.ts | 33 +++---------------- 1 file changed, 4 insertions(+), 29 deletions(-) diff --git a/test/repositories/UnoptimizedInMemoryShuttleRepositoryTests.test.ts b/test/repositories/UnoptimizedInMemoryShuttleRepositoryTests.test.ts index d7c0544..030e423 100644 --- a/test/repositories/UnoptimizedInMemoryShuttleRepositoryTests.test.ts +++ b/test/repositories/UnoptimizedInMemoryShuttleRepositoryTests.test.ts @@ -303,28 +303,15 @@ describe("UnoptimizedInMemoryRepository", () => { }); }); - describe("addOrUpdateSystem", () => { - test("adds a new system if nonexistent", async () => { + describe("updateSystem", () => { + test("adds a new system", async () => { const mockSystems = generateMockSystems(); const newSystem = mockSystems[0]; await repository.updateSystem(newSystem); const result = await repository.getSystemIfExists(); - expect(result).toEqual([newSystem]); - }); - - test("updates an existing system if it exists", async () => { - const mockSystems = generateMockSystems(); - const existingSystem = mockSystems[0]; - const updatedSystem = structuredClone(existingSystem); - updatedSystem.name = "Updated System"; - - await repository.updateSystem(existingSystem); - await repository.updateSystem(updatedSystem); - - const result = await repository.getSystemIfExists(); - expect(result).toEqual([updatedSystem]); + expect(result).toEqual(newSystem); }); }); @@ -634,18 +621,6 @@ describe("UnoptimizedInMemoryRepository", () => { }); describe("clearSystemData", () => { - test("clears all systems from the repository", async () => { - const mockSystems = generateMockSystems(); - for (const system of mockSystems) { - await repository.updateSystem(system); - } - - await repository.clearSystemData(); - - const result = await repository.getSystemIfExists(); - expect(result).toEqual([]); - }); - test("clears system data when the repository has data", async () => { const mockSystems = generateMockSystems(); const system = mockSystems[0]; @@ -654,7 +629,7 @@ describe("UnoptimizedInMemoryRepository", () => { await repository.clearSystemData(); const result = await repository.getSystemIfExists(); - expect(result).toEqual([]); + expect(result).toEqual(null); }); });