@media-quest/engine 0.0.6 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
1
  import { NextQue } from "./next-que";
2
2
  import { PageDto } from "../dto/SchemaDto";
3
+ import { PageID } from "../utils/ID";
3
4
 
4
5
  const tag1 = "tag1";
5
6
  const tag2 = "tag2";
@@ -7,102 +8,102 @@ const tag3 = "tag3";
7
8
 
8
9
  let que = new NextQue();
9
10
  const createPage = () => {};
10
- const p1: PageDto = { id: "1", elements: [], tags: [tag1] };
11
- const p2: PageDto = { id: "2", elements: [], tags: [] };
12
- const p3: PageDto = { id: "3", elements: [], tags: [tag2] };
13
- const p4: PageDto = { id: "4", elements: [], tags: [] };
14
- const p5: PageDto = { id: "5", elements: [], tags: [tag3, tag2] };
15
- const p6: PageDto = { id: "6", elements: [], tags: [tag3] };
11
+ const p1: PageDto = { id: PageID.create(), elements: [], tags: [tag1] };
12
+ const p2: PageDto = { id: PageID.create(), elements: [], tags: [] };
13
+ const p3: PageDto = { id: PageID.create(), elements: [], tags: [tag2] };
14
+ const p4: PageDto = { id: PageID.create(), elements: [], tags: [] };
15
+ const p5: PageDto = { id: PageID.create(), elements: [], tags: [tag3, tag2] };
16
+ const p6: PageDto = { id: PageID.create(), elements: [], tags: [tag3] };
16
17
  const all = [p1, p2, p3, p4, p5, p6];
17
18
 
18
19
  beforeEach(() => {
19
- que = new NextQue();
20
+ que = new NextQue();
20
21
  });
21
22
 
22
23
  describe("NextQue testing", () => {
23
- it("Can pop", () => {
24
- que.resetQue(all);
25
- expect(que.pop()).toBe(p1);
26
- expect(que.pop()).toBe(p2);
27
- expect(que.size).toBe(all.length - 2);
28
- });
24
+ it("Can pop", () => {
25
+ que.resetQue(all);
26
+ expect(que.pop()).toBe(p1);
27
+ expect(que.pop()).toBe(p2);
28
+ expect(que.size).toBe(all.length - 2);
29
+ });
29
30
 
30
- it("Can remove by tag", () => {
31
- que.resetQue(all);
32
- expect(que.size).toBe(6);
33
- que.removeByTag(tag3);
34
- expect(que.size).toBe(4);
35
- expect(que.peek()).toBe(p1);
36
- que.pop();
37
- expect(que.peek()).toBe(p2);
38
- expect(que.size).toBe(3);
39
- });
31
+ it("Can remove by tag", () => {
32
+ que.resetQue(all);
33
+ expect(que.size).toBe(6);
34
+ que.removeByTag(tag3);
35
+ expect(que.size).toBe(4);
36
+ expect(que.peek()).toBe(p1);
37
+ que.pop();
38
+ expect(que.peek()).toBe(p2);
39
+ expect(que.size).toBe(3);
40
+ });
40
41
 
41
- it("Can remove by tags[]", () => {
42
- que.resetQue(all);
43
- que.removeByTag([tag3, tag2, tag1]);
44
- expect(que.size).toBe(2);
45
- });
42
+ it("Can remove by tags[]", () => {
43
+ que.resetQue(all);
44
+ que.removeByTag([tag3, tag2, tag1]);
45
+ expect(que.size).toBe(2);
46
+ });
46
47
 
47
- it("Can remove by pageIds[]", () => {
48
- que.resetQue(all);
49
- que.removeByPageId([p1.id, p2.id, p3.id]);
50
- expect(que.pop()).toBe(p4);
51
- expect(que.size).toBe(2);
52
- });
48
+ it("Can remove by pageIds[]", () => {
49
+ que.resetQue(all);
50
+ que.removeByPageId([p1.id, p2.id, p3.id]);
51
+ expect(que.pop()).toBe(p4);
52
+ expect(que.size).toBe(2);
53
+ });
53
54
 
54
- it("Can remove by pageId", () => {
55
- que.resetQue(all);
56
- que.removeByPageId(p1.id);
57
- expect(que.peek()).toBe(p2);
58
- que.pop();
59
- expect(que.peek()).toBe(p3);
60
- expect(que.size).toBe(4);
61
- que.removeByPageId(p3.id);
62
- expect(que.size).toBe(3);
63
- });
55
+ it("Can remove by pageId", () => {
56
+ que.resetQue(all);
57
+ que.removeByPageId(p1.id);
58
+ expect(que.peek()).toBe(p2);
59
+ que.pop();
60
+ expect(que.peek()).toBe(p3);
61
+ expect(que.size).toBe(4);
62
+ que.removeByPageId(p3.id);
63
+ expect(que.size).toBe(3);
64
+ });
64
65
 
65
- it("Can set pages in constuctor", () => {
66
- que = new NextQue(all);
67
- expect(que.size).toBe(all.length);
68
- });
66
+ it("Can set pages in constuctor", () => {
67
+ que = new NextQue(all);
68
+ expect(que.size).toBe(all.length);
69
+ });
69
70
 
70
- it("Can set pages in constuctor", () => {
71
- que = new NextQue(all);
72
- expect(que.size).toBe(all.length);
73
- });
71
+ it("Can set pages in constuctor", () => {
72
+ que = new NextQue(all);
73
+ expect(que.size).toBe(all.length);
74
+ });
74
75
 
75
- it("Can reset que to start over.", () => {
76
- que = new NextQue(all);
77
- expect(que.size).toBe(all.length);
78
- });
76
+ it("Can reset que to start over.", () => {
77
+ que = new NextQue(all);
78
+ expect(que.size).toBe(all.length);
79
+ });
79
80
 
80
- it("Can insert new pages in the middle of the test.", () => {
81
- que = new NextQue(all);
82
- que.pop();
83
- que.pop();
84
- que.pop();
85
- expect(que.peek()).toBe(p4);
86
- que.insertAsNextByForce([p1, p2]);
87
- expect(que.peek()).toBe(p1);
88
- expect(que.size).toBe(5);
89
- expect(que.pop()).toBe(p1);
90
- expect(que.pop()).toBe(p2);
91
- expect(que.pop()).toBe(p4);
92
- });
81
+ it("Can insert new pages in the middle of the test.", () => {
82
+ que = new NextQue(all);
83
+ que.pop();
84
+ que.pop();
85
+ que.pop();
86
+ expect(que.peek()).toBe(p4);
87
+ que.insertAsNextByForce([p1, p2]);
88
+ expect(que.peek()).toBe(p1);
89
+ expect(que.size).toBe(5);
90
+ expect(que.pop()).toBe(p1);
91
+ expect(que.pop()).toBe(p2);
92
+ expect(que.pop()).toBe(p4);
93
+ });
93
94
 
94
- it("Can jump to page by id", () => {
95
- que = new NextQue(all);
96
- que.pop();
97
- que.jumpToPageById(p5.id);
98
- // expect(que.size).toBe(5);
99
- expect(que.peek()).toBe(p5);
100
- que.jumpToPageById("noncence");
101
- expect(que.peek()).toBe(p5);
102
- // CAn not jump back
103
- que.jumpToPageById(p2.id);
104
- expect(que.peek()).toBe(p5);
105
- que.jumpToPageById(p6.id);
106
- expect(que.peek()).toBe(p6);
107
- });
95
+ it("Can jump to page by id", () => {
96
+ que = new NextQue(all);
97
+ que.pop();
98
+ que.jumpToPageById(p5.id);
99
+ // expect(que.size).toBe(5);
100
+ expect(que.peek()).toBe(p5);
101
+ que.jumpToPageById("noncence");
102
+ expect(que.peek()).toBe(p5);
103
+ // CAn not jump back
104
+ que.jumpToPageById(p2.id);
105
+ expect(que.peek()).toBe(p5);
106
+ que.jumpToPageById(p6.id);
107
+ expect(que.peek()).toBe(p6);
108
+ });
108
109
  });
package/src/public-api.ts CHANGED
@@ -16,3 +16,4 @@ export * from "./Delement/DAuto-play";
16
16
  export * from "./Delement/css";
17
17
 
18
18
  export * from "./utils/DUtil";
19
+ export * from "./utils/ID";