mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
Fixing /Get settings test #569
This commit is contained in:
parent
bd5f89fd09
commit
dc6407251f
@ -3,8 +3,9 @@ import * as fs from 'fs';
|
||||
import {Config} from '../../../../../src/common/config/private/Config';
|
||||
import {SQLConnection} from '../../../../../src/backend/model/database/sql/SQLConnection';
|
||||
import {Server} from '../../../../../src/backend/server';
|
||||
import {DatabaseType} from '../../../../../src/common/config/private/PrivateConfig';
|
||||
import {DatabaseType, ServerConfig} from '../../../../../src/common/config/private/PrivateConfig';
|
||||
import {ProjectPath} from '../../../../../src/backend/ProjectPath';
|
||||
import {TAGS} from '../../../../../src/common/config/public/ClientConfig';
|
||||
|
||||
process.env.NODE_ENV = 'test';
|
||||
const chai: any = require('chai');
|
||||
@ -33,8 +34,8 @@ describe('SettingsRouter', () => {
|
||||
it('it should GET the settings', async () => {
|
||||
Config.Users.authenticationRequired = false;
|
||||
const originalSettings = await Config.original();
|
||||
originalSettings.Server.sessionSecret = null;
|
||||
originalSettings.Users.enforcedUsers = null;
|
||||
// originalSettings.Server.sessionSecret = null;
|
||||
// originalSettings.Users.enforcedUsers = null;
|
||||
const srv = new Server();
|
||||
await srv.onStarted.wait();
|
||||
const result = await chai.request(srv.App)
|
||||
@ -43,9 +44,13 @@ describe('SettingsRouter', () => {
|
||||
result.res.should.have.status(200);
|
||||
result.body.should.be.a('object');
|
||||
should.equal(result.body.error, null);
|
||||
result.body.result.Server.Environment.upTime = null;
|
||||
(result.body.result as ServerConfig).Environment.upTime = null;
|
||||
originalSettings.Environment.upTime = null;
|
||||
result.body.result.should.deep.equal(JSON.parse(JSON.stringify(originalSettings.toJSON({attachState: true, attachVolatile: true}))));
|
||||
result.body.result.should.deep.equal(JSON.parse(JSON.stringify(originalSettings.toJSON({
|
||||
attachState: true,
|
||||
attachVolatile: true,
|
||||
skipTags: {secret: true} as TAGS
|
||||
}))));
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user