CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
sagemathinc

Real-time collaboration for Jupyter Notebooks, Linux Terminals, LaTeX, VS Code, R IDE, and more,
all in one place.

GitHub Repository: sagemathinc/cocalc
Path: blob/master/src/packages/database/postgres/stats.test.ts
Views: 687
1
// to access the non-exported RESERVED object
2
process.env["NODE_DEV"] = "TEST";
3
4
import * as stats from "@cocalc/database/postgres/stats";
5
6
test("query", () => {
7
const countQuery = (stats as any)._count_opened_files_query;
8
const q = countQuery(true);
9
expect(q.indexOf("'sage-chat'")).toBeGreaterThan(0);
10
expect(q.indexOf("SELECT DISTINCT")).toBeGreaterThan(0);
11
12
const q2 = countQuery(false);
13
expect(q2.indexOf("'slides'")).toBeGreaterThan(0);
14
expect(q2.indexOf("SELECT event")).toBeGreaterThan(0);
15
});
16
17