mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 07:50:31 +00:00
update setup method to correctly create new system for testing every test
This commit is contained in:
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user