mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
display parking system in system resolver and remove unnecessary test
This commit is contained in:
@@ -78,5 +78,18 @@ export const SystemResolvers: Resolvers<ServerContext> = {
|
|||||||
|
|
||||||
return await system.shuttleRepository.getShuttles();
|
return await system.shuttleRepository.getShuttles();
|
||||||
},
|
},
|
||||||
|
parkingSystem: async (parent, _args, contextValue, _info) => {
|
||||||
|
const system = contextValue.findSystemById(parent.id);
|
||||||
|
if (!system) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
const parkingRepository = system.parkingRepository;
|
||||||
|
if (!parkingRepository) return null;
|
||||||
|
|
||||||
|
return {
|
||||||
|
systemId: parent.id,
|
||||||
|
};
|
||||||
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,18 +68,6 @@ describe("ParkingSystemResolver", () => {
|
|||||||
const parkingStructures = (response.body.singleResult.data as any).system.parkingSystem.parkingStructures;
|
const parkingStructures = (response.body.singleResult.data as any).system.parkingSystem.parkingStructures;
|
||||||
expect(parkingStructures).toHaveLength(0);
|
expect(parkingStructures).toHaveLength(0);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("returns a blank array if there is no parking data available", async () => {
|
|
||||||
context.systems[0].parkingTimedDataLoader = null;
|
|
||||||
context.systems[0].parkingRepository = null;
|
|
||||||
|
|
||||||
const response = await getResponseFromQueryNeedingSystemId(query);
|
|
||||||
|
|
||||||
assert(response.body.kind === "single");
|
|
||||||
expect(response.body.singleResult.errors).toBeUndefined();
|
|
||||||
const parkingStructures = (response.body.singleResult.data as any).system.parkingSystem.parkingStructures;
|
|
||||||
expect(parkingStructures).toHaveLength(0);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user