-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from mrc-ide/mrc-6203
mrc-6203 Deploy test page
- Loading branch information
Showing
8 changed files
with
71 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Request, Response } from "express"; | ||
import { AppLocals } from "../types/app.js"; | ||
import * as path from "node:path"; | ||
|
||
export class TestPageController { | ||
static getTestPage = (req: Request, res: Response) => { | ||
const { rootDir } = req.app.locals as AppLocals; | ||
res.sendFile(path.join(rootDir, "static", "test.html")); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { describe, expect, test, vi } from "vitest"; | ||
import { TestPageController } from "../../../src/controllers/testPageController"; | ||
|
||
describe("TestPageController", () => { | ||
test("sends test page file", () => { | ||
const req = { | ||
app: { | ||
locals: { | ||
rootDir: "testRoot" | ||
} | ||
} | ||
} as any; | ||
const res = { | ||
sendFile: vi.fn() | ||
} as any; | ||
TestPageController.getTestPage(req, res); | ||
expect(res.sendFile).toHaveBeenCalledWith("testRoot/static/test.html"); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters