mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-28 08:48:45 +02:00
[test] add test for i18n currentLocale
This commit is contained in:
parent
288e87bb3d
commit
11abc1f1e0
15
jest.config.js
Normal file
15
jest.config.js
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
module.exports = {
|
||||||
|
"verbose": true,
|
||||||
|
"preset": "jest-puppeteer",
|
||||||
|
"globals": {
|
||||||
|
"__DEV__": true
|
||||||
|
},
|
||||||
|
"testRegex": "./test/*.spec.js",
|
||||||
|
"rootDir": ".",
|
||||||
|
"testTimeout": 30000,
|
||||||
|
"transform": {
|
||||||
|
"^.+\\.js$": "babel-jest",
|
||||||
|
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub"
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
10
package.json
10
package.json
@ -115,15 +115,5 @@
|
|||||||
"stylelint-config-standard": "~22.0.0",
|
"stylelint-config-standard": "~22.0.0",
|
||||||
"typescript": "~4.4.3",
|
"typescript": "~4.4.3",
|
||||||
"vite": "~2.6.4"
|
"vite": "~2.6.4"
|
||||||
},
|
|
||||||
"jest": {
|
|
||||||
"verbose": true,
|
|
||||||
"preset": "jest-puppeteer",
|
|
||||||
"globals": {
|
|
||||||
"__DEV__": true
|
|
||||||
},
|
|
||||||
"testRegex": "./test/*.spec.js",
|
|
||||||
"rootDir": ".",
|
|
||||||
"testTimeout": 30000
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -43,3 +43,9 @@ app.component("Editable", contenteditable);
|
|||||||
app.component("FontAwesomeIcon", FontAwesomeIcon);
|
app.component("FontAwesomeIcon", FontAwesomeIcon);
|
||||||
|
|
||||||
app.mount("#app");
|
app.mount("#app");
|
||||||
|
|
||||||
|
// Expose the vue instance for development
|
||||||
|
if (process.env.NODE_ENV === "development") {
|
||||||
|
console.log("Dev Only: window.app is the vue instance");
|
||||||
|
window.app = app._instance;
|
||||||
|
}
|
||||||
|
@ -74,7 +74,7 @@ class TimeLogger {
|
|||||||
this.startTime = dayjs().valueOf();
|
this.startTime = dayjs().valueOf();
|
||||||
}
|
}
|
||||||
print(name) {
|
print(name) {
|
||||||
if (exports.isDev && process && process.env.TIMELOGGER === "1") {
|
if (exports.isDev && process.env.TIMELOGGER === "1") {
|
||||||
console.log(name + ": " + (dayjs().valueOf() - this.startTime) + "ms");
|
console.log(name + ": " + (dayjs().valueOf() - this.startTime) + "ms");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -86,7 +86,7 @@ export class TimeLogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
print(name: string) {
|
print(name: string) {
|
||||||
if (isDev && process && process.env.TIMELOGGER === "1") {
|
if (isDev && process.env.TIMELOGGER === "1") {
|
||||||
console.log(name + ": " + (dayjs().valueOf() - this.startTime) + "ms")
|
console.log(name + ": " + (dayjs().valueOf() - this.startTime) + "ms")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
const { Page, Browser } = require("puppeteer");
|
const { Page, Browser } = require("puppeteer");
|
||||||
const { sleep } = require("../src/util");
|
const { sleep } = require("../src/util");
|
||||||
const axios = require("axios");
|
const axios = require("axios");
|
||||||
|
const { currentLocale } = require("../src/i18n");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set back the correct data type for page object
|
* Set back the correct data type for page object
|
||||||
@ -223,6 +224,14 @@ describe("Init", () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Test i18n.js", () => {
|
||||||
|
|
||||||
|
it("currentLocale()", () => {
|
||||||
|
expect(currentLocale()).toMatch("");
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
async function login(username, password) {
|
async function login(username, password) {
|
||||||
await input(page, "#floatingInput", username);
|
await input(page, "#floatingInput", username);
|
||||||
await input(page, "#floatingPassword", password);
|
await input(page, "#floatingPassword", password);
|
||||||
|
@ -6,5 +6,4 @@ FROM ubuntu
|
|||||||
# RUN ln -s /usr/bin/nodejs /usr/bin/node
|
# RUN ln -s /usr/bin/nodejs /usr/bin/node
|
||||||
# RUN node -v
|
# RUN node -v
|
||||||
|
|
||||||
COPY ./install.sh .
|
RUN curl -o kuma_install.sh http://git.kuma.pet/install.sh && bash kuma_install.sh local /opt/uptime-kuma 3000 0.0.0.0
|
||||||
RUN bash install.sh local /opt/uptime-kuma 3000 0.0.0.0
|
|
||||||
|
Loading…
Reference in New Issue
Block a user