forked from SolidOS/solid-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.test.ts
More file actions
59 lines (55 loc) · 2.43 KB
/
Copy pathindex.test.ts
File metadata and controls
59 lines (55 loc) · 2.43 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
55
56
57
58
59
import { silenceDebugMessages } from '../../helpers/setup'
import {
initFooter,
rebuildFooter,
createControllerInfoBlock
} from '../../../src/footer'
import { NamedNode } from 'rdflib'
// @ts-ignore
import { solidLogicSingleton } from '../../../src/logic'
const store = solidLogicSingleton.store
silenceDebugMessages()
describe('footer', () => {
it('is exposed on public API', async () => {
const options = { solidProjectUrl: 'https://solid.com/', solidProjectName: 'Solid Project' }
expect(await initFooter(store, options)).toMatchSnapshot()
})
})
describe('rebuildFooter', () => {
it('creates a link', () => {
const footer = document.createElement('div')
const pod = new NamedNode('https://test.com')
const podOwner = new NamedNode('https://test2.com')
const options = { solidProjectUrl: 'https://solid.com/', solidProjectName: 'Solid Project' }
expect(rebuildFooter(footer, store, pod, podOwner, options)).toMatchSnapshot()
})
it('does NOT creates a link in the footer', () => {
const footer = document.createElement('div')
const pod = new NamedNode('https://test.com')
const podOwner = new NamedNode('https://test.com')
expect(rebuildFooter(footer, store, pod, podOwner)).toMatchSnapshot()
})
})
describe('createControllerInfoBlock', () => {
it('runs createControllerInfoBlock', async () => {
const pod = new NamedNode('https://test.com')
const podOwner = new NamedNode('https://test.com')
const user = new NamedNode('https://sharonstrats.inrupt.net/profile/card#me')
expect(createControllerInfoBlock(store, user, pod, podOwner)).toMatchSnapshot()
})
it('assigns class to footer', async () => {
const pod = new NamedNode('https://test.com')
const podOwner = new NamedNode('https://test.com')
const user = new NamedNode('https://sharonstrats.inrupt.net/profile/card#me')
const footer = createControllerInfoBlock(store, user, pod, podOwner)
expect(footer.className).toContain('footer-pod-info')
expect(footer.className).toContain('footer')
})
it('makes use of options', async () => {
const pod = new NamedNode('https://test.com')
const podOwner = new NamedNode('https://test.com')
const user = new NamedNode('https://sharonstrats.inrupt.net/profile/card#me')
const options = { solidProjectUrl: 'https://solid.com/', solidProjectName: 'Solid Project' }
expect(createControllerInfoBlock(store, user, pod, podOwner, options)).toMatchSnapshot()
})
})