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/sync/table/test/util.test.ts
Views: 687
1
/*
2
* This file is part of CoCalc: Copyright © 2020 Sagemath, Inc.
3
* License: MS-RSL – see LICENSE.md for details
4
*/
5
6
import { to_key } from "../util";
7
8
test("convert string to string key", () => {
9
expect(to_key("foo")).toBe("foo");
10
});
11
12
test("convert string[] to string key", () => {
13
expect(to_key(["foo", "bar"])).toBe('["foo","bar"]');
14
});
15
16
test("convert undefined to string key", () => {
17
expect(to_key(undefined)).toBe(undefined);
18
});
19
20
test("convert number to string key", () => {
21
// numbers come up in postgresql sequential id primary keys
22
expect(to_key(10)).toBe("10");
23
});
24
25