update setup method to correctly create new system for testing every test

This commit is contained in:
2025-04-07 12:26:18 -07:00
parent 2ba64a9b0d
commit d20711d53d

View File

@@ -19,6 +19,17 @@ function setUpTestServer() {
}); });
} }
const systemInfoForTesting = {
id: "1", name: "Chapman University", passioSystemId: "263"
};
export function buildSystemForTesting() {
return InterchangeSystem.build(
systemInfoForTesting,
new InMemoryNotificationRepository()
);
}
/** /**
* Returns a `ServerContext` object which can be passed to requests * Returns a `ServerContext` object which can be passed to requests
* for testing. * for testing.
@@ -26,18 +37,11 @@ function setUpTestServer() {
export function setupTestServerContext() { export function setupTestServerContext() {
const context: { [key: string] : any } = {}; const context: { [key: string] : any } = {};
const systems = [
InterchangeSystem.build(
{
id: "1", name: "Chapman University", passioSystemId: "263"
},
new InMemoryNotificationRepository()
),
]
beforeEach(() => { beforeEach(() => {
context.systems = systems; context.systems = [
context.findSystemById = (_: string) => systems[0]; buildSystemForTesting(),
];
context.findSystemById = (_: string) => context.systems[0];
}); });
return context as ServerContext; return context as ServerContext;