mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
rename update method and update return types
This commit is contained in:
@@ -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();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user