rename update method and update return types

This commit is contained in:
2025-04-06 09:51:13 -07:00
parent 7e0c1f3539
commit 695fec1fce
10 changed files with 26 additions and 28 deletions

View File

@@ -24,7 +24,7 @@ describe("UnoptimizedInMemoryRepository", () => {
describe("getSystems", () => {
test("gets the system stored in the repository", async () => {
const mockSystems = generateMockSystems();
await repository.addOrUpdateSystem(mockSystems[0]);
await repository.updateSystem(mockSystems[0]);
const result = await repository.getSystemIfExists();
@@ -42,7 +42,7 @@ describe("UnoptimizedInMemoryRepository", () => {
test("gets a system by the ID if it exists", async () => {
const mockSystems = generateMockSystems();
for (const system of mockSystems) {
await repository.addOrUpdateSystem(system);
await repository.updateSystem(system);
}
const result = await repository.getSystemById("2");
@@ -327,7 +327,7 @@ describe("UnoptimizedInMemoryRepository", () => {
const mockSystems = generateMockSystems();
const newSystem = mockSystems[0];
await repository.addOrUpdateSystem(newSystem);
await repository.updateSystem(newSystem);
const result = await repository.getSystemIfExists();
expect(result).toEqual([newSystem]);
@@ -339,8 +339,8 @@ describe("UnoptimizedInMemoryRepository", () => {
const updatedSystem = structuredClone(existingSystem);
updatedSystem.name = "Updated System";
await repository.addOrUpdateSystem(existingSystem);
await repository.addOrUpdateSystem(updatedSystem);
await repository.updateSystem(existingSystem);
await repository.updateSystem(updatedSystem);
const result = await repository.getSystemIfExists();
expect(result).toEqual([updatedSystem]);
@@ -476,7 +476,7 @@ describe("UnoptimizedInMemoryRepository", () => {
test("removes system given ID", async () => {
const mockSystems = generateMockSystems();
await Promise.all(mockSystems.map(async (system) => {
await repository.addOrUpdateSystem(system);
await repository.updateSystem(system);
}));
const systemToRemove = mockSystems[0];
@@ -489,7 +489,7 @@ describe("UnoptimizedInMemoryRepository", () => {
test("does nothing if system doesn't exist", async () => {
const mockSystems = generateMockSystems();
await Promise.all(mockSystems.map(async (system) => {
await repository.addOrUpdateSystem(system);
await repository.updateSystem(system);
}));
await repository.removeSystemIfExists("nonexistent-id");
@@ -664,7 +664,7 @@ describe("UnoptimizedInMemoryRepository", () => {
test("clears all systems from the repository", async () => {
const mockSystems = generateMockSystems();
for (const system of mockSystems) {
await repository.addOrUpdateSystem(system);
await repository.updateSystem(system);
}
await repository.clearSystemData();
@@ -676,7 +676,7 @@ describe("UnoptimizedInMemoryRepository", () => {
test("clears system data when the repository has data", async () => {
const mockSystems = generateMockSystems();
const system = mockSystems[0];
await repository.addOrUpdateSystem(system);
await repository.updateSystem(system);
await repository.clearSystemData();