forked from SolidOS/solid-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdateFolder.test.ts
More file actions
54 lines (48 loc) · 1.85 KB
/
dateFolder.test.ts
File metadata and controls
54 lines (48 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
import { silenceDebugMessages } from '../helpers/debugger'
import { DateFolder } from '../../../src/chat/dateFolder'
import { sym } from 'rdflib'
silenceDebugMessages()
describe('DateFolder', () => {
it('exists', () => {
expect(new DateFolder(sym('https://domain.tld/dir/'))).toBeInstanceOf(DateFolder)
})
})
describe('DateFolder#leafDocumentFromDate', () => {
it('exists', () => {
expect(new DateFolder(sym('https://domain.tld/dir/')).leafDocumentFromDate).toBeInstanceOf(Function)
})
it('runs', () => {
const dateFolder = new DateFolder(sym('https://domain.tld/dir/'))
const result = dateFolder.leafDocumentFromDate(new Date(2020, 1, 1))
expect(result).toBeTruthy()
})
})
describe('DateFolder#dateFromLeafDocument', () => {
it('exists', () => {
expect(new DateFolder(sym('https://domain.tld/dir/')).dateFromLeafDocument).toBeInstanceOf(Function)
})
it('runs', () => {
const dateFolder = new DateFolder(sym('https://domain.tld/dir/'))
const result = dateFolder.dateFromLeafDocument(sym('https://domain.tld/2020/01'))
expect(result).toEqual(new Date('2020'))
})
})
describe('DateFolder#loadPrevious', () => {
it('exists', () => {
expect(new DateFolder(sym('https://domain.tld/dir/')).loadPrevious).toBeInstanceOf(Function)
})
it('runs', async () => {
const dateFolder = new DateFolder(sym('https://domain.tld/dir/'))
const result = await dateFolder.loadPrevious(new Date(2020, 1, 1))
expect(result).toEqual(null)
})
})
describe('DateFolder#firstLeaf', () => {
it('exists', () => {
expect(new DateFolder(sym('https://domain.tld/dir/')).firstLeaf).toBeInstanceOf(Function)
})
it('runs', async () => {
const dateFolder = new DateFolder(sym('https://domain.tld/dir/'))
await expect(dateFolder.firstLeaf()).rejects.toThrow(' @@@ No children to parent2 <https://domain.tld/>')
})
})