1
0
Fork 0
mirror of https://github.com/Eggbertx/gochan.git synced 2025-08-07 01:56:24 -07:00

Add Jest for JavaScript testing

This commit is contained in:
Eggbertx 2022-01-27 23:26:30 -08:00
parent 1be572dc40
commit 8b92872677
8 changed files with 8331 additions and 36 deletions

View file

@ -0,0 +1,20 @@
import {test, expect} from "@jest/globals";
import "./inittests";
test("Checks for valid mock server timezone (serverTZ)", () => {
expect(isNaN(serverTZ)).toBe(false);
});
test("Checks mock themes to make sure the default one (defaultStyle) exists and is pipes.css", () => {
let styleName = "";
for(const style of styles) {
if(style.Filename == defaultStyle) {
styleName = style.Name;
}
}
expect(styleName).toBe("Pipes");
});
test("tests mock webroot, should be /", () => {
expect(webroot).toBe("/");
});

View file

@ -0,0 +1,16 @@
// mock variables the browser would normally get from {webroot}js/consts.js
global.styles=[
{Name: "Pipes", Filename: "pipes.css"},
{Name: "BunkerChan", Filename: "bunkerchan.css"},
{Name: "Burichan", Filename: "burichan.css"},
{Name: "Clear", Filename: "clear.css"},
{Name: "Dark", Filename: "dark.css"},
{Name: "Photon", Filename: "photon.css"},
{Name: "Yotsuba", Filename: "yotsuba.css"},
{Name: "Yotsuba B", Filename: "yotsubab.css"},
{Name: "Windows 9x", Filename: "win9x.css"}
];
global.defaultStyle = "pipes.css";
global.webroot = "/";
global.serverTZ = -8;