2019-12-17 19:24:37 +08:00
|
|
|
const en = require("../src/i18n/strings/en_EN");
|
|
|
|
|
|
|
|
module.exports = jest.fn((opts, cb) => {
|
2020-01-16 22:01:15 +08:00
|
|
|
const url = opts.url || opts.uri;
|
|
|
|
if (url && url.endsWith("languages.json")) {
|
2019-12-17 19:24:37 +08:00
|
|
|
cb(undefined, {status: 200}, JSON.stringify({
|
|
|
|
"en": {
|
|
|
|
"fileName": "en_EN.json",
|
|
|
|
"label": "English",
|
|
|
|
},
|
|
|
|
}));
|
2020-01-16 22:01:15 +08:00
|
|
|
} else if (url && url.endsWith("en_EN.json")) {
|
2019-12-17 19:24:37 +08:00
|
|
|
cb(undefined, {status: 200}, JSON.stringify(en));
|
|
|
|
} else {
|
2020-01-16 22:06:54 +08:00
|
|
|
cb(true, {status: 404}, "");
|
2019-12-17 19:24:37 +08:00
|
|
|
}
|
|
|
|
});
|