@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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@media-quest/engine",
3
- "version": "0.0.6",
3
+ "version": "0.0.8",
4
4
  "description": "Rendering engine for media-quest schemas.",
5
5
  "main": "dist/public-api.js",
6
6
  "module": "dist/public-api.mjs",
@@ -10,6 +10,6 @@
10
10
  "clean": "rimraf dist",
11
11
  "build": "npm run clean && tsup src/public-api.ts --sourcemap inline --format cjs,esm --dts",
12
12
  "prepublishOnly": "npm run build",
13
- "tsc:check": "tsc --watch --noEmit"
13
+ "tsc:check:engine": "tsc --watch --noEmit"
14
14
  }
15
15
  }
@@ -2,6 +2,7 @@ import { DStyle } from "../Delement/DStyle";
2
2
  import { AnimationDto } from "../dto/AnimationDto";
3
3
  import { Fact } from "../rules/fact";
4
4
  import { DState } from "../state/Dstate";
5
+ import { PageID } from "../utils/ID";
5
6
 
6
7
  type CommandTarget = "VIDEO" | "AUDIO" | "ELEMENT" | "PAGE_QUE" | "ENGINE" | "STATE";
7
8
  type CommandKind = `${Uppercase<CommandTarget>}_${Uppercase<string>}_COMMAND`;
@@ -10,53 +11,53 @@ export type StateCommand = CommandDto<"STATE_MUTATE_COMMAND", "STATE", { mutatio
10
11
  // export type StateCommand = CommandDto<"STATE_MUTATE_COMMAND", "STATE", { mutation: DState.StateMutation }>;
11
12
 
12
13
  export type NavigationCommand =
13
- | CommandDto<"PAGE_QUE_NEXT_PAGE_COMMAND", "PAGE_QUE", {}>
14
- | CommandDto<"PAGE_QUE_GO_TO_SEQUENCE_COMMAND", "PAGE_QUE", { sequenceId: string }>
15
- | CommandDto<"PAGE_QUE_GO_TO_PAGE_COMMAND", "PAGE_QUE", { pageId: string }>;
14
+ | CommandDto<"PAGE_QUE_NEXT_PAGE_COMMAND", "PAGE_QUE", {}>
15
+ | CommandDto<"PAGE_QUE_GO_TO_SEQUENCE_COMMAND", "PAGE_QUE", { sequenceId: string }>
16
+ | CommandDto<"PAGE_QUE_GO_TO_PAGE_COMMAND", "PAGE_QUE", { pageId: string }>;
16
17
 
17
18
  export type EngineCommand = CommandDto<
18
- "ENGINE_LEAVE_PAGE_COMMAND",
19
- "ENGINE",
20
- {
21
- readonly pageId: string;
22
- readonly factsCollected: ReadonlyArray<Fact>;
23
- }
19
+ "ENGINE_LEAVE_PAGE_COMMAND",
20
+ "ENGINE",
21
+ {
22
+ readonly pageId: string;
23
+ readonly factsCollected: ReadonlyArray<Fact>;
24
+ }
24
25
  >;
25
26
 
26
27
  interface CommandDto<K extends CommandKind, T extends CommandTarget, P> {
27
- readonly kind: K;
28
- readonly target: T;
29
- readonly targetId: T | Omit<string, T>;
30
- readonly payload: P;
28
+ readonly kind: K;
29
+ readonly target: T;
30
+ readonly targetId: T | Omit<string, T>;
31
+ readonly payload: P;
31
32
  }
32
33
 
33
34
  export type VideoCommand =
34
- | CommandDto<"VIDEO_PLAY_COMMAND", "VIDEO", { volume?: number }>
35
- | CommandDto<"VIDEO_SET_VOLUME_COMMAND", "VIDEO", { volume: number }>
36
- | CommandDto<"VIDEO_JUMP_TO_COMMAND", "VIDEO", { volume?: number; ms: number }>
37
- | CommandDto<"VIDEO_PAUSE_COMMAND", "VIDEO", {}>;
35
+ | CommandDto<"VIDEO_PLAY_COMMAND", "VIDEO", { volume?: number }>
36
+ | CommandDto<"VIDEO_SET_VOLUME_COMMAND", "VIDEO", { volume: number }>
37
+ | CommandDto<"VIDEO_JUMP_TO_COMMAND", "VIDEO", { volume?: number; ms: number }>
38
+ | CommandDto<"VIDEO_PAUSE_COMMAND", "VIDEO", {}>;
38
39
 
39
40
  export type AudioCommand =
40
- | CommandDto<"AUDIO_PAUSE_COMMAND", "AUDIO", {}>
41
- | CommandDto<"AUDIO_PLAY_COMMAND", "AUDIO", { volume?: number; startAt?: number }>
42
- | CommandDto<"AUDIO_SET_VOLUME_COMMAND", "AUDIO", { volume: number }>;
41
+ | CommandDto<"AUDIO_PAUSE_COMMAND", "AUDIO", {}>
42
+ | CommandDto<"AUDIO_PLAY_COMMAND", "AUDIO", { volume?: number; startAt?: number }>
43
+ | CommandDto<"AUDIO_SET_VOLUME_COMMAND", "AUDIO", { volume: number }>;
43
44
 
44
45
  export type ElementCommand =
45
- | CommandDto<"ELEMENT_ANIMATE_COMMAND", "ELEMENT", AnimationDto>
46
- | CommandDto<"ELEMENT_DISABLE_CLICK_COMMAND", "ELEMENT", {}>
47
- | CommandDto<"ELEMENT_ENABLE_CLICK_COMMAND", "ELEMENT", {}>
48
- | CommandDto<"ELEMENT_STYLE_COMMAND", "ELEMENT", { changes: Partial<DStyle>; clickIsAllowed?: boolean }>;
46
+ | CommandDto<"ELEMENT_ANIMATE_COMMAND", "ELEMENT", AnimationDto>
47
+ | CommandDto<"ELEMENT_DISABLE_CLICK_COMMAND", "ELEMENT", {}>
48
+ | CommandDto<"ELEMENT_ENABLE_CLICK_COMMAND", "ELEMENT", {}>
49
+ | CommandDto<"ELEMENT_STYLE_COMMAND", "ELEMENT", { changes: Partial<DStyle>; clickIsAllowed?: boolean }>;
49
50
 
50
51
  export type PageQueCommand =
51
- | CommandDto<"PAGE_QUE_EXCLUDE_BY_TAG_COMMAND", "PAGE_QUE", { tagIds: string[] }>
52
- | CommandDto<"PAGE_QUE_EXCLUDE_BY_PAGE_ID_COMMAND", "PAGE_QUE", { pageIds: Array<string> }>
53
- | CommandDto<"PAGE_QUE_JUMP_TO_PAGE_COMMAND", "PAGE_QUE", { readonly pageId: string }>;
52
+ | CommandDto<"PAGE_QUE_EXCLUDE_BY_TAG_COMMAND", "PAGE_QUE", { tagIds: string[] }>
53
+ | CommandDto<"PAGE_QUE_EXCLUDE_BY_PAGE_ID_COMMAND", "PAGE_QUE", { pageIds: Array<PageID> }>
54
+ | CommandDto<"PAGE_QUE_JUMP_TO_PAGE_COMMAND", "PAGE_QUE", { readonly pageId: string }>;
54
55
 
55
56
  export type DCommand =
56
- | StateCommand
57
- | NavigationCommand
58
- | VideoCommand
59
- | AudioCommand
60
- | ElementCommand
61
- | EngineCommand
62
- | PageQueCommand;
57
+ | StateCommand
58
+ | NavigationCommand
59
+ | VideoCommand
60
+ | AudioCommand
61
+ | ElementCommand
62
+ | EngineCommand
63
+ | PageQueCommand;
@@ -4,62 +4,62 @@ import { Rule } from "../rules/rule";
4
4
  import { Fact } from "../rules/fact";
5
5
  import { PageQueCommand } from "../commands/DCommand";
6
6
  import { DState } from "../state/Dstate";
7
+ import { PageID, SchemaID } from "../utils/ID";
7
8
 
8
9
  export type PageQueRules = Rule<PageQueCommand, never>;
9
10
  export interface PageDto {
10
- readonly id: string;
11
- readonly elements: Array<DElementDto>;
12
- readonly tags?: string[];
13
- readonly mainVideoId?: string;
14
- readonly backgroundColor?: string;
15
- readonly video?: Array<DVideoDto>;
16
- readonly audio?: Array<DAudioDto>;
17
- readonly autoPlaySequence?: DAutoPlaySequence;
11
+ readonly id: PageID;
12
+ readonly elements: Array<DElementDto>;
13
+ readonly tags?: string[];
14
+ readonly mainVideoId?: string;
15
+ readonly backgroundColor?: string;
16
+ readonly video?: Array<DVideoDto>;
17
+ readonly audio?: Array<DAudioDto>;
18
+ readonly autoPlaySequence?: DAutoPlaySequence;
18
19
  }
19
20
 
20
21
  export interface PageSequenceDto {
21
- readonly id: string;
22
- readonly rules: Array<PageQueRules>;
23
- readonly pages: Array<PageDto>;
22
+ readonly id: string;
23
+ readonly rules: Array<PageQueRules>;
24
+ readonly pages: Array<PageDto>;
24
25
  }
25
26
 
26
27
  export interface SchemaDto {
27
- readonly id: string;
28
- readonly prefix: string;
29
- readonly baseHeight: number;
30
- readonly baseWidth: number;
31
- readonly backgroundColor: string;
32
- readonly pages: PageDto[];
33
- readonly rules: Array<PageQueRules>;
34
- readonly stateProps?: ReadonlyArray<DState.Prop>;
35
- readonly stateQueries?: ReadonlyArray<DState.StateQuery>;
36
- readonly stateFromEvent: ReadonlyArray<DState.fromEventHandler>;
37
- readonly pageSequences?: Array<PageSequenceDto>;
38
- readonly predefinedFacts?: ReadonlyArray<Fact>;
28
+ readonly id: SchemaID;
29
+ readonly baseHeight: number;
30
+ readonly baseWidth: number;
31
+ readonly backgroundColor: string;
32
+ readonly pages: PageDto[];
33
+ readonly rules: Array<PageQueRules>;
34
+ readonly stateProps?: ReadonlyArray<DState.Prop>;
35
+ readonly stateQueries?: ReadonlyArray<DState.StateQuery>;
36
+ readonly stateFromEvent: ReadonlyArray<DState.fromEventHandler>;
37
+ readonly pageSequences?: Array<PageSequenceDto>;
38
+ readonly predefinedFacts?: ReadonlyArray<Fact>;
39
39
  }
40
40
 
41
41
  export namespace SchemaDto {
42
- export const getResources = (
43
- schema: SchemaDto
44
- ): {
45
- videoList: ReadonlyArray<DVideoDto>;
46
- audioList: ReadonlyArray<DAudioDto>;
47
- imageList: ReadonlyArray<DImgDto>;
48
- } => {
49
- const { pages } = schema;
50
- const videoList = pages.reduce<Array<DVideoDto>>((acc, curr) => {
51
- if (Array.isArray(curr.video)) {
52
- acc.push(...curr.video);
53
- }
54
- return acc;
55
- }, []);
56
- const audioList: Array<DAudioDto> = pages.reduce<Array<DAudioDto>>((acc, curr) => {
57
- if (Array.isArray(curr.audio)) {
58
- acc.push(...curr.audio);
59
- }
60
- return acc;
61
- }, []);
42
+ export const getResources = (
43
+ schema: SchemaDto,
44
+ ): {
45
+ videoList: ReadonlyArray<DVideoDto>;
46
+ audioList: ReadonlyArray<DAudioDto>;
47
+ imageList: ReadonlyArray<DImgDto>;
48
+ } => {
49
+ const { pages } = schema;
50
+ const videoList = pages.reduce<Array<DVideoDto>>((acc, curr) => {
51
+ if (Array.isArray(curr.video)) {
52
+ acc.push(...curr.video);
53
+ }
54
+ return acc;
55
+ }, []);
56
+ const audioList: Array<DAudioDto> = pages.reduce<Array<DAudioDto>>((acc, curr) => {
57
+ if (Array.isArray(curr.audio)) {
58
+ acc.push(...curr.audio);
59
+ }
60
+ return acc;
61
+ }, []);
62
62
 
63
- return { videoList, audioList, imageList: [] };
64
- };
63
+ return { videoList, audioList, imageList: [] };
64
+ };
65
65
  }
@@ -7,49 +7,54 @@ import { DTimestamp } from "../common/DTimestamp";
7
7
  import { ScaleService } from "./scale";
8
8
 
9
9
  export class DPage {
10
- private readonly TAG = "[ DPage ]: ";
11
- private elements: DElement<HTMLElement>[] = [];
12
- private readonly eventBus;
13
- private readonly commandBus;
14
- private readonly scale: ScaleService;
15
- // Todo GLOBAL EVENT_BUSS AND PAGE EVENTS:
10
+ private readonly TAG = "[ DPage ]: ";
11
+ private elements: DElement<HTMLElement>[] = [];
12
+ private readonly eventBus;
13
+ private readonly commandBus;
14
+ private readonly scale: ScaleService;
15
+ // Todo GLOBAL EVENT_BUSS AND PAGE EVENTS:
16
16
 
17
- constructor(private readonly dto: PageDto, eventBus: EventBus, commandBus: DCommandBus, scale: ScaleService) {
18
- this.eventBus = eventBus;
19
- this.commandBus = commandBus;
20
- this.scale = scale;
21
- this.elements = dto.elements.map((dto) => createDElement(dto, this.commandBus, this.eventBus, this.scale));
22
- }
17
+ constructor(
18
+ private readonly dto: PageDto,
19
+ eventBus: EventBus,
20
+ commandBus: DCommandBus,
21
+ scale: ScaleService,
22
+ ) {
23
+ this.eventBus = eventBus;
24
+ this.commandBus = commandBus;
25
+ this.scale = scale;
26
+ this.elements = dto.elements.map((dto) => createDElement(dto, this.commandBus, this.eventBus, this.scale));
27
+ }
23
28
 
24
- appendYourself(parent: HTMLElement) {
25
- // console.log(this.TAG + " APPENDING TO PARENT");
26
- this.elements.forEach((el) => {
27
- el.appendYourself(parent);
28
- // parent.appendChild(el.el);
29
- });
29
+ appendYourself(parent: HTMLElement) {
30
+ // console.log(this.TAG + " APPENDING TO PARENT");
31
+ this.elements.forEach((el) => {
32
+ el.appendYourself(parent);
33
+ // parent.appendChild(el.el);
34
+ });
30
35
 
31
- // if (!preloadMode) {
32
- this.eventBus.emit({
33
- kind: "PAGE_ENTER_EVENT",
34
- timestamp: DTimestamp.now(),
35
- producer: "DPage",
36
- producerId: this.id,
37
- data: { pageId: this.id },
38
- });
39
- // }
40
- }
36
+ // if (!preloadMode) {
37
+ this.eventBus.emit({
38
+ kind: "PAGE_ENTER_EVENT",
39
+ timestamp: DTimestamp.now(),
40
+ producer: "DPage",
41
+ producerId: this.id,
42
+ data: { pageId: this.id },
43
+ });
44
+ // }
45
+ }
41
46
 
42
- destroy() {
43
- this.elements.forEach((el) => {
44
- el.destroy();
45
- });
46
- }
47
+ destroy() {
48
+ this.elements.forEach((el) => {
49
+ el.destroy();
50
+ });
51
+ }
47
52
 
48
- log(): void {
49
- // console.log(this.TAG + 'scale - ' + this.scale);
50
- }
53
+ log(): void {
54
+ // console.log(this.TAG + 'scale - ' + this.scale);
55
+ }
51
56
 
52
- get id() {
53
- return this.dto.id;
54
- }
57
+ get id() {
58
+ return this.dto.id;
59
+ }
55
60
  }
@@ -4,9 +4,10 @@ import { Rule } from "../rules/rule";
4
4
  import { PageHistory } from "./history-que";
5
5
  import { DTimestamp } from "../common/DTimestamp";
6
6
  import { PageQueCommand } from "../commands/DCommand";
7
+ import { PageID } from "../utils/ID";
7
8
 
8
9
  const page = (id: number): PageDto => {
9
- return { id: "" + id, elements: [] };
10
+ return { id: PageID.create(), elements: [] };
10
11
  };
11
12
  const p1 = page(1);
12
13
  const p2 = page(2);
@@ -16,93 +17,93 @@ const p5 = page(5);
16
17
  const p6 = page(6);
17
18
  const all = [p1, p2, p3, p4, p5, p6];
18
19
  const Seq1 = {
19
- p10: page(10),
20
- p11: page(11),
21
- p12: page(12),
20
+ p10: page(10),
21
+ p11: page(11),
22
+ p12: page(12),
22
23
  };
23
24
 
24
25
  const seq1: PageSequenceDto = {
25
- id: "s1",
26
- pages: [Seq1.p10, Seq1.p11, Seq1.p12],
27
- rules: [],
26
+ id: "s1",
27
+ pages: [Seq1.p10, Seq1.p11, Seq1.p12],
28
+ rules: [],
28
29
  };
29
30
  const data = (
30
- pages: PageDto[],
31
- pageSequences: PageSequenceDto[] = [],
32
- rules: Rule<PageQueCommand, never>[] = []
31
+ pages: PageDto[],
32
+ pageSequences: PageSequenceDto[] = [],
33
+ rules: Rule<PageQueCommand, never>[] = [],
33
34
  ): DPlayerData => ({ pages, pageSequences, rules });
34
35
  // const seq = (pages: PageDto[], rules: Rule[]) => {};
35
36
  beforeEach(() => {
36
- // data = { pages: [], rules: [], pageSequences: [] };
37
+ // data = { pages: [], rules: [], pageSequences: [] };
37
38
  });
38
39
 
39
40
  describe("DPlayer", () => {
40
- it("should create an instance", () => {
41
- const player = new DPlayer(data([p1, p1]));
42
- expect(player).toBeTruthy();
43
- });
41
+ it("should create an instance", () => {
42
+ const player = new DPlayer(data([p1, p1]));
43
+ expect(player).toBeTruthy();
44
+ });
44
45
 
45
- it("can app pages, and get next", () => {
46
- const player = new DPlayer(data([p1, p2]));
46
+ it("can app pages, and get next", () => {
47
+ const player = new DPlayer(data([p1, p2]));
47
48
 
48
- expect(player.getNextPage()).toBe(p1);
49
- expect(player.getNextPage()).toBe(p2);
50
- expect(player.getNextPage()).toBe(false);
51
- });
49
+ expect(player.getNextPage()).toBe(p1);
50
+ expect(player.getNextPage()).toBe(p2);
51
+ expect(player.getNextPage()).toBe(false);
52
+ });
52
53
 
53
- it("Can insert a sequence", () => {
54
- const player = new DPlayer(data(all, [seq1]));
54
+ it("Can insert a sequence", () => {
55
+ const player = new DPlayer(data(all, [seq1]));
55
56
 
56
- expect(player.getNextPage()).toBe(p1);
57
- expect(player.getNextPage()).toBe(p2);
58
- player.handleNavigationCommand({
59
- kind: "PAGE_QUE_GO_TO_SEQUENCE_COMMAND",
60
- target: "PAGE_QUE",
61
- targetId: "PAGE_QUE",
62
- payload: {
63
- sequenceId: seq1.id,
64
- },
65
- });
66
- expect(player.getNextPage()).toBe(Seq1.p10);
67
- expect(player.getNextPage()).toBe(Seq1.p11);
68
- expect(player.getNextPage()).toBe(Seq1.p12);
69
- expect(player.getNextPage()).toBe(p3);
57
+ expect(player.getNextPage()).toBe(p1);
58
+ expect(player.getNextPage()).toBe(p2);
59
+ player.handleNavigationCommand({
60
+ kind: "PAGE_QUE_GO_TO_SEQUENCE_COMMAND",
61
+ target: "PAGE_QUE",
62
+ targetId: "PAGE_QUE",
63
+ payload: {
64
+ sequenceId: seq1.id,
65
+ },
70
66
  });
67
+ expect(player.getNextPage()).toBe(Seq1.p10);
68
+ expect(player.getNextPage()).toBe(Seq1.p11);
69
+ expect(player.getNextPage()).toBe(Seq1.p12);
70
+ expect(player.getNextPage()).toBe(p3);
71
+ });
71
72
 
72
- it("Can jump forward to a pageId", () => {
73
- const player = new DPlayer(data(all));
73
+ it("Can jump forward to a pageId", () => {
74
+ const player = new DPlayer(data(all));
74
75
 
75
- expect(player.getNextPage()).toBe(p1);
76
- player.handleNavigationCommand({
77
- kind: "PAGE_QUE_GO_TO_PAGE_COMMAND",
78
- target: "PAGE_QUE",
79
- targetId: "PAGE_QUE",
80
- payload: { pageId: p4.id },
81
- });
82
- expect(player.getNextPage()).toBe(p4);
76
+ expect(player.getNextPage()).toBe(p1);
77
+ player.handleNavigationCommand({
78
+ kind: "PAGE_QUE_GO_TO_PAGE_COMMAND",
79
+ target: "PAGE_QUE",
80
+ targetId: "PAGE_QUE",
81
+ payload: { pageId: p4.id },
83
82
  });
83
+ expect(player.getNextPage()).toBe(p4);
84
+ });
84
85
 
85
- it("Save history", () => {
86
- const player = new DPlayer(data(all));
87
- const curr = player.getNextPage() as PageDto;
86
+ it("Save history", () => {
87
+ const player = new DPlayer(data(all));
88
+ const curr = player.getNextPage() as PageDto;
88
89
 
89
- const history: PageHistory = {
90
- pageId: curr.id,
91
- answeredQuestions: [
92
- {
93
- timestamp: DTimestamp.now(),
94
- fact: {
95
- referenceId: "as",
96
- referenceLabel: "as-label",
97
- kind: "numeric-fact",
98
- label: "litt",
99
- value: 2,
100
- },
101
- },
102
- ],
103
- };
104
- player.saveHistory(history);
105
- expect(player.getNextPage()).toBe(p2);
106
- expect(player.getResults().length).toBe(1);
107
- });
90
+ const history: PageHistory = {
91
+ pageId: curr.id,
92
+ answeredQuestions: [
93
+ {
94
+ timestamp: DTimestamp.now(),
95
+ fact: {
96
+ referenceId: "as",
97
+ referenceLabel: "as-label",
98
+ kind: "numeric-fact",
99
+ label: "litt",
100
+ value: 2,
101
+ },
102
+ },
103
+ ],
104
+ };
105
+ player.saveHistory(history);
106
+ expect(player.getNextPage()).toBe(p2);
107
+ expect(player.getResults().length).toBe(1);
108
+ });
108
109
  });
@@ -1,24 +1,25 @@
1
1
  import { AnsweredQuestion, HistoryQue, PageHistory } from "./history-que";
2
2
  import { DTimestamp } from "../common/DTimestamp";
3
3
  import { PageDto } from "../dto/SchemaDto";
4
+ import { PageID } from "../utils/ID";
4
5
 
5
6
  const p = (id: number): PageDto => {
6
- return { id: "" + id, elements: [] };
7
+ return { id: PageID.create(), elements: [] };
7
8
  };
8
9
 
9
10
  const answer = (id: number, value: number): AnsweredQuestion => ({
10
- timestamp: DTimestamp.now(),
11
- fact: {
12
- referenceId: "" + id,
13
- referenceLabel: "label-for-" + id,
14
- value,
15
- label: "value-label " + value,
16
- kind: "numeric-fact",
17
- },
11
+ timestamp: DTimestamp.now(),
12
+ fact: {
13
+ referenceId: "" + id,
14
+ referenceLabel: "label-for-" + id,
15
+ value,
16
+ label: "value-label " + value,
17
+ kind: "numeric-fact",
18
+ },
18
19
  });
19
20
  const h = (page: PageDto, answeredQuestions: AnsweredQuestion[]): PageHistory => ({
20
- pageId: page.id,
21
- answeredQuestions,
21
+ pageId: page.id,
22
+ answeredQuestions,
22
23
  });
23
24
  const p1 = p(1);
24
25
  const p2 = p(2);
@@ -30,16 +31,16 @@ const all = [p1, p2, p3, p4, p5, p6];
30
31
 
31
32
  let history = new HistoryQue();
32
33
  beforeEach(() => {
33
- history = new HistoryQue();
34
+ history = new HistoryQue();
34
35
  });
35
36
 
36
37
  describe("HistoryQue", () => {
37
- it("should create an instance", () => {
38
- expect(history).toBeTruthy();
39
- });
38
+ it("should create an instance", () => {
39
+ expect(history).toBeTruthy();
40
+ });
40
41
 
41
- it("Can add history, and get facts back", () => {
42
- history.addToHistory(h(p1, [answer(1, 2)]));
43
- expect(history.getFacts().length).toBe(1);
44
- });
42
+ it("Can add history, and get facts back", () => {
43
+ history.addToHistory(h(p1, [answer(1, 2)]));
44
+ expect(history.getFacts().length).toBe(1);
45
+ });
45
46
  });