forked from SolidOS/solid-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparticipation.test.ts
More file actions
97 lines (94 loc) · 2.76 KB
/
participation.test.ts
File metadata and controls
97 lines (94 loc) · 2.76 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
import * as widgets from '../../src/widgets'
import { JSDOM } from 'jsdom'
import * as participation from '../../src/pad'
const window = new JSDOM('<!DOCTYPE html><p>Hello world</p>').window
const dom = window.document
describe('renderParticipants', () => {
it('exists', () => {
expect((participation as any).renderParticipants).toBeInstanceOf(Function)
})
it('runs', () => {
const table = dom.createElement('table')
const padDoc = null
// const subject = new RdfLib.NamedNode('test')
const subject = null
const me = 'webId'
const options = {}
expect(
(participation as any).renderParticipants(dom, table, padDoc, subject, me, options)
).toMatchSnapshot()
})
it('returns without crashing when a person is not returned', () => {
// @@ TODO need to mock kb.any and kb.each - not working for some reason
// kb is a store
const table = dom.createElement('table')
const padDoc = null
// const subject = new RdfLib.NamedNode('participation')
const subject = null
const me = 'webId'
const options = {}
expect(
(participation as any).renderParticipants(dom, table, padDoc, subject, me, options)
).toMatchSnapshot()
})
})
describe('participationObject', () => {
it('exists', () => {
expect((participation as any).participationObject).toBeInstanceOf(Function)
})
it.skip('runs', () => {
// TODO: check on arguments
const subject = null
const padDoc = null
const me = null
expect((participation as any).participationObject(subject, padDoc, me)).resolves.toBe(
{}
)
})
it.skip('runs 2', () => {
// TODO: check on arguments
const spy = jest.spyOn(widgets, 'newThing')
const subject = null
const padDoc = document
const me = 'https://sharonstrats.inrupt.net/profile/card#me'
expect((participation as any).participationObject(subject, padDoc, me)).resolves.toBe(
{}
)
expect(spy).toBeCalled()
})
})
describe('recordParticipation', () => {
it('exists', () => {
expect((participation as any).recordParticipation).toBeInstanceOf(Function)
})
const subject = null
const padDoc = null
const refreshable = true
it('runs', () => {
expect((participation as any).recordParticipation(subject, padDoc, refreshable)).toBe(
undefined
)
})
})
describe('manageParticipation', () => {
it('exists', () => {
expect((participation as any).manageParticipation).toBeInstanceOf(Function)
})
const container = dom.createElement('div')
const padDoc = null
const subject = null
const me = null
const options = {}
it('runs', () => {
expect(
(participation as any).manageParticipation(
dom,
container,
padDoc,
subject,
me,
options
)
).toMatchSnapshot()
})
})