mirror of
https://github.com/gristlabs/grist-core.git
synced 2026-03-02 04:09:24 +00:00
(core) updates from grist-core
This commit is contained in:
@@ -5,6 +5,7 @@ import {HomeDBManager} from 'app/gen-server/lib/HomeDBManager';
|
||||
import {Permissions} from 'app/gen-server/lib/Permissions';
|
||||
import {assert} from 'chai';
|
||||
import {addSeedData, createInitialDb, removeConnection, setUpDB} from 'test/gen-server/seed';
|
||||
import {EnvironmentSnapshot} from 'test/server/testUtils';
|
||||
|
||||
import {Initial1536634251710 as Initial} from 'app/gen-server/migration/1536634251710-Initial';
|
||||
import {Login1539031763952 as Login} from 'app/gen-server/migration/1539031763952-Login';
|
||||
@@ -63,11 +64,19 @@ function assertMembersGroup(org: Organization, exists: boolean) {
|
||||
}
|
||||
|
||||
describe('migrations', function() {
|
||||
let oldEnv: EnvironmentSnapshot;
|
||||
|
||||
before(function() {
|
||||
oldEnv = new EnvironmentSnapshot();
|
||||
// This test is incompatible with TEST_CLEAN_DATABASE.
|
||||
delete process.env.TEST_CLEAN_DATABASE;
|
||||
setUpDB(this);
|
||||
});
|
||||
|
||||
after(function() {
|
||||
oldEnv.restore();
|
||||
});
|
||||
|
||||
beforeEach(async function() {
|
||||
await home.connect();
|
||||
await createInitialDb(home.connection, false);
|
||||
|
||||
@@ -37,7 +37,6 @@ import {signal} from 'test/server/lib/helpers/Signal';
|
||||
import {TestServer} from 'test/server/lib/helpers/TestServer';
|
||||
import * as testUtils from 'test/server/testUtils';
|
||||
import {waitForIt} from 'test/server/wait';
|
||||
import clone = require('lodash/clone');
|
||||
import defaultsDeep = require('lodash/defaultsDeep');
|
||||
import pick = require('lodash/pick');
|
||||
|
||||
@@ -71,9 +70,11 @@ let userApi: UserAPIImpl;
|
||||
describe('DocApi', function () {
|
||||
this.timeout(30000);
|
||||
testUtils.setTmpLogLevel('error');
|
||||
const oldEnv = clone(process.env);
|
||||
let oldEnv: testUtils.EnvironmentSnapshot;
|
||||
|
||||
before(async function () {
|
||||
oldEnv = new testUtils.EnvironmentSnapshot();
|
||||
|
||||
// Clear redis test database if redis is in use.
|
||||
if (process.env.TEST_REDIS_URL) {
|
||||
const cli = createClient(process.env.TEST_REDIS_URL);
|
||||
@@ -94,7 +95,7 @@ describe('DocApi', function () {
|
||||
});
|
||||
|
||||
after(() => {
|
||||
Object.assign(process.env, oldEnv);
|
||||
oldEnv.restore();
|
||||
});
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {prepareDatabase} from 'test/server/lib/helpers/PrepareDatabase';
|
||||
import {TestServer} from 'test/server/lib/helpers/TestServer';
|
||||
import {createTestDir, setTmpLogLevel} from 'test/server/testUtils';
|
||||
import * as testUtils from 'test/server/testUtils';
|
||||
import {waitForIt} from 'test/server/wait';
|
||||
import {assert} from 'chai';
|
||||
import fetch from 'node-fetch';
|
||||
@@ -17,12 +18,18 @@ describe('UnhandledErrors', function() {
|
||||
setTmpLogLevel('warn');
|
||||
|
||||
let testDir: string;
|
||||
let oldEnv: testUtils.EnvironmentSnapshot;
|
||||
|
||||
before(async function() {
|
||||
oldEnv = new testUtils.EnvironmentSnapshot();
|
||||
testDir = await createTestDir('UnhandledErrors');
|
||||
await prepareDatabase(testDir);
|
||||
});
|
||||
|
||||
after(function() {
|
||||
oldEnv.restore();
|
||||
});
|
||||
|
||||
for (const errType of ['exception', 'rejection', 'error-event']) {
|
||||
it(`should clean up on unhandled ${errType}`, async function() {
|
||||
// Capture server log output, so that we can look to see how the server coped.
|
||||
|
||||
@@ -14,7 +14,6 @@ import {signal} from 'test/server/lib/helpers/Signal';
|
||||
import {TestProxyServer} from 'test/server/lib/helpers/TestProxyServer';
|
||||
import {TestServer} from 'test/server/lib/helpers/TestServer';
|
||||
import * as testUtils from 'test/server/testUtils';
|
||||
import clone = require('lodash/clone');
|
||||
|
||||
const chimpy = configForUser('Chimpy');
|
||||
|
||||
@@ -39,12 +38,12 @@ async function cleanRedisDatabase() {
|
||||
}
|
||||
|
||||
function backupEnvironmentVariables() {
|
||||
let oldEnv: NodeJS.ProcessEnv;
|
||||
let oldEnv: testUtils.EnvironmentSnapshot;
|
||||
before(() => {
|
||||
oldEnv = clone(process.env);
|
||||
oldEnv = new testUtils.EnvironmentSnapshot();
|
||||
});
|
||||
after(() => {
|
||||
Object.assign(process.env, oldEnv);
|
||||
oldEnv.restore();
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user