-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Test factory to create maps and nodes (#323)
- Loading branch information
1 parent
dc42961
commit 695eabb
Showing
2 changed files
with
74 additions
and
118 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { MmpMap } from "src/map/entities/mmpMap.entity"; | ||
import { MmpNode } from "src/map/entities/mmpNode.entity"; | ||
import * as crypto from 'crypto' | ||
import { IMmpClientMap, IMmpClientNodeBasics } from "src/map/types"; | ||
|
||
export const createMmpMap = (overrides = {}): MmpMap => ({ | ||
id: crypto.randomUUID(), | ||
adminId: 'admin-id', | ||
modificationSecret: 'modification-secret', | ||
name: 'Test Map', | ||
lastModified: new Date('1970-01-01'), | ||
options: { | ||
fontMaxSize: 1, | ||
fontMinSize: 1, | ||
fontIncrement: 1 | ||
}, | ||
nodes: Array<MmpNode>(), | ||
...overrides | ||
}) | ||
|
||
export const createMmpClientMap = (overrides = {}): IMmpClientMap => ({ | ||
uuid: crypto.randomUUID(), | ||
data: [], | ||
deleteAfterDays: 30, | ||
deletedAt: new Date('1970-01-01'), | ||
lastModified: new Date('1970-01-01'), | ||
options: { | ||
fontMaxSize: 1, | ||
fontMinSize: 1, | ||
fontIncrement: 1 | ||
}, | ||
...overrides, | ||
}) | ||
|
||
export const createClientRootNode = (overrides = {}): IMmpClientNodeBasics => ({ | ||
colors: { | ||
name: '', | ||
background: '', | ||
branch: '', | ||
}, | ||
font: { | ||
style: '', | ||
size: 0, | ||
weight: '' | ||
}, | ||
name: 'Root node', | ||
image: { | ||
src: '', | ||
size: 0 | ||
}, | ||
...overrides | ||
}) |