mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
rename get system method on shuttle repository, update tests
This commit is contained in:
@@ -22,21 +22,19 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
});
|
||||
|
||||
describe("getSystems", () => {
|
||||
test("gets the systems stored in the repository", async () => {
|
||||
test("gets the system stored in the repository", async () => {
|
||||
const mockSystems = generateMockSystems();
|
||||
for (const system of mockSystems) {
|
||||
await repository.addOrUpdateSystem(system);
|
||||
}
|
||||
await repository.addOrUpdateSystem(mockSystems[0]);
|
||||
|
||||
const result = await repository.getSystems();
|
||||
const result = await repository.getSystemIfExists();
|
||||
|
||||
expect(result).toEqual(mockSystems);
|
||||
expect(result).toEqual(mockSystems[0]);
|
||||
});
|
||||
|
||||
test("gets an empty list if there are no systems stored", async () => {
|
||||
const result = await repository.getSystems();
|
||||
test("gets null if there is no data associated with the system", async () => {
|
||||
const result = await repository.getSystemIfExists();
|
||||
|
||||
expect(result).toEqual([]);
|
||||
expect(result).toEqual(null);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -331,7 +329,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.addOrUpdateSystem(newSystem);
|
||||
|
||||
const result = await repository.getSystems();
|
||||
const result = await repository.getSystemIfExists();
|
||||
expect(result).toEqual([newSystem]);
|
||||
});
|
||||
|
||||
@@ -344,7 +342,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
await repository.addOrUpdateSystem(existingSystem);
|
||||
await repository.addOrUpdateSystem(updatedSystem);
|
||||
|
||||
const result = await repository.getSystems();
|
||||
const result = await repository.getSystemIfExists();
|
||||
expect(result).toEqual([updatedSystem]);
|
||||
});
|
||||
});
|
||||
@@ -484,7 +482,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
const systemToRemove = mockSystems[0];
|
||||
await repository.removeSystemIfExists(systemToRemove.id);
|
||||
|
||||
const remainingSystems = await repository.getSystems();
|
||||
const remainingSystems = await repository.getSystemIfExists();
|
||||
expect(remainingSystems).toHaveLength(mockSystems.length - 1);
|
||||
});
|
||||
|
||||
@@ -496,7 +494,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.removeSystemIfExists("nonexistent-id");
|
||||
|
||||
const remainingSystems = await repository.getSystems();
|
||||
const remainingSystems = await repository.getSystemIfExists();
|
||||
expect(remainingSystems).toHaveLength(mockSystems.length);
|
||||
});
|
||||
});
|
||||
@@ -671,7 +669,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.clearSystemData();
|
||||
|
||||
const result = await repository.getSystems();
|
||||
const result = await repository.getSystemIfExists();
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
|
||||
@@ -682,7 +680,7 @@ describe("UnoptimizedInMemoryRepository", () => {
|
||||
|
||||
await repository.clearSystemData();
|
||||
|
||||
const result = await repository.getSystems();
|
||||
const result = await repository.getSystemIfExists();
|
||||
expect(result).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user