mirror of
https://github.com/gristlabs/grist-core.git
synced 2024-10-27 20:44:07 +00:00
(core) updates from grist-core
This commit is contained in:
commit
f5c44a50c1
@ -12,7 +12,7 @@
|
|||||||
"install:python3": "buildtools/prepare_python3.sh",
|
"install:python3": "buildtools/prepare_python3.sh",
|
||||||
"build:prod": "buildtools/build.sh",
|
"build:prod": "buildtools/build.sh",
|
||||||
"start:prod": "sandbox/run.sh",
|
"start:prod": "sandbox/run.sh",
|
||||||
"test": "GRIST_SESSION_COOKIE=grist_test_cookie GRIST_TEST_LOGIN=1 TEST_SUPPORT_API_KEY=api_key_for_support TEST_CLEAN_DATABASE=true NODE_PATH=_build:_build/stubs:_build/ext mocha ${DEBUG:+-b --no-exit} ${DEBUG:---forbid-only} -g ${GREP_TESTS:-''} _build/test/common/*.js _build/test/client/*.js _build/test/nbrowser/*.js _build/test/server/**/*.js _build/test/gen-server/**/*.js",
|
"test": "GRIST_SESSION_COOKIE=grist_test_cookie GRIST_TEST_LOGIN=1 TEST_SUPPORT_API_KEY=api_key_for_support TEST_CLEAN_DATABASE=true NODE_PATH=_build:_build/stubs:_build/ext mocha ${DEBUG:+-b --no-exit} --slow 8000 ${DEBUG:---forbid-only} -g ${GREP_TESTS:-''} _build/test/common/*.js _build/test/client/*.js _build/test/nbrowser/*.js _build/test/server/**/*.js _build/test/gen-server/**/*.js",
|
||||||
"test:nbrowser": "GRIST_SESSION_COOKIE=grist_test_cookie GRIST_TEST_LOGIN=1 TEST_SUPPORT_API_KEY=api_key_for_support TEST_CLEAN_DATABASE=true NODE_PATH=_build:_build/stubs:_build/ext mocha ${DEBUG:+-b --no-exit} ${DEBUG:---forbid-only} -g ${GREP_TESTS:-''} --slow 8000 _build/test/nbrowser/**/*.js",
|
"test:nbrowser": "GRIST_SESSION_COOKIE=grist_test_cookie GRIST_TEST_LOGIN=1 TEST_SUPPORT_API_KEY=api_key_for_support TEST_CLEAN_DATABASE=true NODE_PATH=_build:_build/stubs:_build/ext mocha ${DEBUG:+-b --no-exit} ${DEBUG:---forbid-only} -g ${GREP_TESTS:-''} --slow 8000 _build/test/nbrowser/**/*.js",
|
||||||
"test:client": "GRIST_SESSION_COOKIE=grist_test_cookie NODE_PATH=_build:_build/stubs:_build/ext mocha ${DEBUG:+'-b'} _build/test/client/**/*.js",
|
"test:client": "GRIST_SESSION_COOKIE=grist_test_cookie NODE_PATH=_build:_build/stubs:_build/ext mocha ${DEBUG:+'-b'} _build/test/client/**/*.js",
|
||||||
"test:common": "GRIST_SESSION_COOKIE=grist_test_cookie NODE_PATH=_build:_build/stubs:_build/ext mocha ${DEBUG:+'-b'} _build/test/common/**/*.js",
|
"test:common": "GRIST_SESSION_COOKIE=grist_test_cookie NODE_PATH=_build:_build/stubs:_build/ext mocha ${DEBUG:+'-b'} _build/test/common/**/*.js",
|
||||||
|
@ -3004,7 +3004,6 @@ function testDocApi() {
|
|||||||
|
|
||||||
before(async function() {
|
before(async function() {
|
||||||
this.timeout(30000);
|
this.timeout(30000);
|
||||||
if (!process.env.TEST_REDIS_URL) { this.skip(); }
|
|
||||||
requests = {
|
requests = {
|
||||||
"add,update": [],
|
"add,update": [],
|
||||||
"add": [],
|
"add": [],
|
||||||
@ -3073,6 +3072,22 @@ function testDocApi() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, webhooksTestPort);
|
}, webhooksTestPort);
|
||||||
|
});
|
||||||
|
|
||||||
|
after(async function() {
|
||||||
|
await serving.shutdown();
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('table endpoints', function() {
|
||||||
|
before(async function() {
|
||||||
|
this.timeout(30000);
|
||||||
|
// We rely on the REDIS server in this test.
|
||||||
|
if (!process.env.TEST_REDIS_URL) { this.skip(); }
|
||||||
|
requests = {
|
||||||
|
"add,update": [],
|
||||||
|
"add": [],
|
||||||
|
"update": [],
|
||||||
|
};
|
||||||
|
|
||||||
redisCalls = [];
|
redisCalls = [];
|
||||||
redisMonitor = createClient(process.env.TEST_REDIS_URL);
|
redisMonitor = createClient(process.env.TEST_REDIS_URL);
|
||||||
@ -3084,7 +3099,6 @@ function testDocApi() {
|
|||||||
|
|
||||||
after(async function() {
|
after(async function() {
|
||||||
if (!process.env.TEST_REDIS_URL) { this.skip(); }
|
if (!process.env.TEST_REDIS_URL) { this.skip(); }
|
||||||
await serving.shutdown();
|
|
||||||
await redisMonitor.quitAsync();
|
await redisMonitor.quitAsync();
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -3218,6 +3232,28 @@ function testDocApi() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe("/webhooks endpoint", function() {
|
||||||
|
let docId: string;
|
||||||
|
let doc: DocAPI;
|
||||||
|
let stats: WebhookSummary[];
|
||||||
|
before(async function() {
|
||||||
|
// Create a test document.
|
||||||
|
const ws1 = (await userApi.getOrgWorkspaces('current'))[0].id;
|
||||||
|
docId = await userApi.newDoc({name: 'testdoc2'}, ws1);
|
||||||
|
doc = userApi.getDocAPI(docId);
|
||||||
|
await axios.post(`${serverUrl}/api/docs/${docId}/apply`, [
|
||||||
|
['ModifyColumn', 'Table1', 'B', {type: 'Bool'}],
|
||||||
|
], chimpy);
|
||||||
|
});
|
||||||
|
|
||||||
|
const waitForQueue = async (length: number) => {
|
||||||
|
await waitForIt(async () => {
|
||||||
|
stats = await readStats(docId);
|
||||||
|
assert.equal(length, _.sum(stats.map(x => x.usage?.numWaiting ?? 0)));
|
||||||
|
}, 1000, 200);
|
||||||
|
};
|
||||||
|
|
||||||
it("should clear the outgoing queue", async() => {
|
it("should clear the outgoing queue", async() => {
|
||||||
// Create a test document.
|
// Create a test document.
|
||||||
@ -3420,27 +3456,6 @@ function testDocApi() {
|
|||||||
await webhook1();
|
await webhook1();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("/webhooks endpoint", function() {
|
|
||||||
let docId: string;
|
|
||||||
let doc: DocAPI;
|
|
||||||
let stats: WebhookSummary[];
|
|
||||||
before(async() => {
|
|
||||||
// Create a test document.
|
|
||||||
const ws1 = (await userApi.getOrgWorkspaces('current'))[0].id;
|
|
||||||
docId = await userApi.newDoc({name: 'testdoc2'}, ws1);
|
|
||||||
doc = userApi.getDocAPI(docId);
|
|
||||||
await axios.post(`${serverUrl}/api/docs/${docId}/apply`, [
|
|
||||||
['ModifyColumn', 'Table1', 'B', {type: 'Bool'}],
|
|
||||||
], chimpy);
|
|
||||||
});
|
|
||||||
|
|
||||||
const waitForQueue = async (length: number) => {
|
|
||||||
await waitForIt(async () => {
|
|
||||||
stats = await readStats(docId);
|
|
||||||
assert.equal(length, _.sum(stats.map(x => x.usage?.numWaiting ?? 0)));
|
|
||||||
}, 1000, 200);
|
|
||||||
};
|
|
||||||
|
|
||||||
it("should return statistics", async() => {
|
it("should return statistics", async() => {
|
||||||
await clearQueue(docId);
|
await clearQueue(docId);
|
||||||
// Read stats, it should be empty.
|
// Read stats, it should be empty.
|
||||||
@ -3771,7 +3786,6 @@ function testDocApi() {
|
|||||||
await unsubscribe(docId, webhook4);
|
await unsubscribe(docId, webhook4);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
describe("Allowed Origin", () => {
|
describe("Allowed Origin", () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user