annotate src/suffixLabels.test.ts @ 32:db0e9cbf52e5

WIP converting to the package system that i found can work
author drewp@bigasterisk.com
date Tue, 24 Dec 2019 18:37:03 -0800
parents 9ec3cbc8791a
children 45ed53428e74
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
20
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
1 // import {describe, test, expect} from 'jest';
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
2 // import { SuffixLabels } from './suffixLabels';
17
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
3
20
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
4 // describe('_tailSegments', () => {
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
5 // test("returns right amount", () => {
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
6 // expect(SuffixLabels._tailSegments('http://foo/a/bb', 0)).toEqual('');
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
7 // // t.is(SuffixLabels._tailSegments('http://foo/a/bb', 1), 'bb');
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
8 // // t.is(SuffixLabels._tailSegments('http://foo/a/bb', 2), 'a/bb');
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
9 // // t.is(SuffixLabels._tailSegments('http://foo/a/bb', 3), 'foo/a/bb');
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
10 // // t.is(SuffixLabels._tailSegments('http://foo/a/bb', 4), '/foo/a/bb');
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
11 // // t.is(SuffixLabels._tailSegments('http://foo/a/bb', 5), 'http://foo/a/bb');
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
12 // });
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
13 // // test("_tailSegments ok with trailing slash", (t) => {
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
14 // // t.is(SuffixLabels._tailSegments('http://foo/', 0), '');
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
15 // // t.is(SuffixLabels._tailSegments('http://foo/', 1), '');
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
16 // // t.is(SuffixLabels._tailSegments('http://foo/', 2), 'foo/');
9ec3cbc8791a build is running, but no tests, and lots of code is disabled
drewp@bigasterisk.com
parents: 17
diff changeset
17 // });
17
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
18
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
19
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
20 // describe("suffixLabels", () => {
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
21 // const fakeNode = (uri: string) => { return { nominalValue: uri } };
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
22
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
23 // it("returns whole url segments", () => {
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
24 // const suf = new SuffixLabels();
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
25 // suf._planDisplayForUri('http://a/b/c/dd');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
26 // suf._planDisplayForUri('http://a/b/c/ee');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
27
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
28 // t.is(suf.getLabelForNode('http://a/b/c/dd'), 'dd');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
29 // t.is(suf.getLabelForNode('http://a/b/c/ee'), 'ee');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
30 // });
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
31
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
32 // it("doesn't treat a repeated uri as a name clash", () => {
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
33 // const suf = new SuffixLabels();
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
34 // suf._planDisplayForUri('http://a/b/c');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
35 // suf._planDisplayForUri('http://a/b/c');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
36
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
37 // t.is(suf.getLabelForNode('http://a/b/c'), 'c');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
38 // });
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
39
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
40 // it("moves to two segments when needed", () => {
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
41 // const suf = new SuffixLabels();
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
42 // suf._planDisplayForUri('http://a/b/c/d');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
43 // suf._planDisplayForUri('http://a/b/f/d');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
44
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
45 // t.is(suf.getLabelForNode('http://a/b/c/d'), 'c/d');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
46 // t.is(suf.getLabelForNode('http://a/b/f/d'), 'f/d');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
47 // });
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
48
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
49 // it("is ok with clashes at different segment positions", () => {
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
50 // const suf = new SuffixLabels();
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
51 // suf._planDisplayForUri('http://z/z/z/a/b/c');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
52 // suf._planDisplayForUri('http://a/b/c');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
53
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
54 // t.is(suf.getLabelForNode('http://z/z/z/a/b/c'), 'z/a/b/c');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
55 // t.is(suf.getLabelForNode('http://a/b/c'), '/a/b/c');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
56 // });
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
57
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
58 // it("uses appropriately long suffixes per uri", () => {
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
59 // const suf = new SuffixLabels();
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
60 // suf._planDisplayForUri('http://a/b/c/d/e');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
61 // suf._planDisplayForUri('http://a/b/f/d/e');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
62 // suf._planDisplayForUri('http://a/b/c/g');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
63 // suf._planDisplayForUri('http://a/z');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
64
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
65 // t.is(suf.getLabelForNode('http://a/b/c/d/e'), 'c/d/e');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
66 // t.is(suf.getLabelForNode('http://a/b/f/d/e'), 'f/d/e');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
67 // t.is(suf.getLabelForNode('http://a/b/c/g'), 'g');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
68 // t.is(suf.getLabelForNode('http://a/z'), 'z');
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
69 // });
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
70
94629c39681c trying to do ts+jest. WIP
drewp@bigasterisk.com
parents:
diff changeset
71 // });