mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-01-19 14:13:34 +01:00
Fixed favicon test
This commit is contained in:
parent
2c81ca33e7
commit
73f70eb9e5
2 changed files with 14 additions and 11 deletions
|
@ -56,6 +56,7 @@ const closeServer = async () => {
|
||||||
await events.once(socketsEvents, 'updated');
|
await events.once(socketsEvents, 'updated');
|
||||||
}
|
}
|
||||||
await p;
|
await p;
|
||||||
|
await appInstance?.shutdown()
|
||||||
appInstance!.close()
|
appInstance!.close()
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
exports.server = null;
|
exports.server = null;
|
||||||
|
|
|
@ -4,8 +4,10 @@ import {MapArrayType} from "../../../node/types/MapType";
|
||||||
|
|
||||||
const assert = require('assert').strict;
|
const assert = require('assert').strict;
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
const fs = require('fs');
|
import {mkdtempSync, readFile, readFileSync} from 'fs';
|
||||||
const fsp = fs.promises;
|
import {rmSync, unlinkSync} from "node:fs";
|
||||||
|
|
||||||
|
|
||||||
const path = require('path');
|
const path = require('path');
|
||||||
const settings = require('../../../node/utils/Settings');
|
const settings = require('../../../node/utils/Settings');
|
||||||
const superagent = require('superagent');
|
const superagent = require('superagent');
|
||||||
|
@ -14,20 +16,20 @@ describe(__filename, function () {
|
||||||
let agent:any;
|
let agent:any;
|
||||||
let backupSettings:MapArrayType<any>;
|
let backupSettings:MapArrayType<any>;
|
||||||
let skinDir: string;
|
let skinDir: string;
|
||||||
let wantCustomIcon: boolean;
|
let wantCustomIcon: Buffer;
|
||||||
let wantDefaultIcon: boolean;
|
let wantDefaultIcon: Buffer;
|
||||||
let wantSkinIcon: boolean;
|
let wantSkinIcon: Buffer;
|
||||||
|
|
||||||
before(async function () {
|
before(async function () {
|
||||||
agent = await common.init();
|
agent = await common.init();
|
||||||
wantCustomIcon = await fsp.readFile(path.join(__dirname, 'favicon-test-custom.png'));
|
wantCustomIcon = readFileSync(path.join(__dirname, 'favicon-test-custom.png'));
|
||||||
wantDefaultIcon = await fsp.readFile(path.join(settings.root, 'src', 'static', 'favicon.ico'));
|
wantDefaultIcon = readFileSync(path.join(settings.root, 'src', 'static', 'favicon.ico'));
|
||||||
wantSkinIcon = await fsp.readFile(path.join(__dirname, 'favicon-test-skin.png'));
|
wantSkinIcon = readFileSync(path.join(__dirname, 'favicon-test-skin.png'));
|
||||||
});
|
});
|
||||||
|
|
||||||
beforeEach(async function () {
|
beforeEach(async function () {
|
||||||
backupSettings = {...settings};
|
backupSettings = {...settings};
|
||||||
skinDir = await fsp.mkdtemp(path.join(settings.root, 'src', 'static', 'skins', 'test-'));
|
skinDir = mkdtempSync(path.join(settings.root, 'src', 'static', 'skins', 'test-'));
|
||||||
settings.skinName = path.basename(skinDir);
|
settings.skinName = path.basename(skinDir);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -36,8 +38,8 @@ describe(__filename, function () {
|
||||||
delete settings.skinName;
|
delete settings.skinName;
|
||||||
Object.assign(settings, backupSettings);
|
Object.assign(settings, backupSettings);
|
||||||
try {
|
try {
|
||||||
await fsp.unlink(path.join(skinDir, 'favicon.ico'));
|
unlinkSync(path.join(skinDir, 'favicon.ico'));
|
||||||
await fsp.rm(skinDir, {recursive: true});
|
rmSync(skinDir, {recursive: true});
|
||||||
} catch (err) { /* intentionally ignored */ }
|
} catch (err) { /* intentionally ignored */ }
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue