forked from SolidOS/solid-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpad.test.ts
More file actions
94 lines (90 loc) · 2.62 KB
/
Copy pathpad.test.ts
File metadata and controls
94 lines (90 loc) · 2.62 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
jest.mock('rdflib')
import * as RdfLib from 'rdflib'
jest.mock('solid-auth-client')
import * as SolidAuthClient from 'solid-auth-client'
import { dom, element } from '../helpers/dom'
import * as pad from '../../src/pad'
describe('lightColorHash', () => {
it('exists', () => {
expect((pad as any).lightColorHash).toBeInstanceOf(Function)
})
it('runs', () => {
expect((pad as any).lightColorHash(null)).toBe('#ffffff')
})
})
describe('renderPartipants', () => {
it('exists', () => {
expect((pad as any).renderPartipants).toBeInstanceOf(Function)
})
it('runs', () => {
const table = dom.createElement()
const padDoc = null
const subject = RdfLib.sym('')
const me = 'webId'
const options = {}
expect(
(pad as any).renderPartipants(dom, table, padDoc, subject, me, options)
).toBeTruthy()
})
})
describe('participationObject', () => {
it('exists', () => {
expect((pad as any).participationObject).toBeInstanceOf(Function)
})
// TODO: check on arguments
const subject = null
const padDoc = null
const me = null
it('runs', () => {
expect((pad as any).participationObject(subject, padDoc, me)).resolves.toBe({})
})
})
describe('recordParticipation', () => {
it('exists', () => {
expect((pad as any).recordParticipation).toBeInstanceOf(Function)
})
const subject = null
const padDoc = null
const refreshable = true
it('runs', () => {
expect((pad as any).recordParticipation(subject, padDoc, refreshable)).toBe(
undefined
)
})
})
describe('manageParticipation', () => {
it('exists', () => {
expect((pad as any).manageParticipation).toBeInstanceOf(Function)
})
const container = dom.createElement()
const padDoc = null
const subject = null
const me = null
const options = {}
it('runs', () => {
expect(
(pad as any).manageParticipation(dom, container, padDoc, subject, me, options)
).toBeTruthy()
})
})
describe('notepad', () => {
it('exists', () => {
expect((pad as any).notepad).toBeInstanceOf(Function)
})
it('runs', () => {
const padDoc = null
const subject = null
const me = RdfLib.sym('')
const options = {}
expect((pad as any).notepad(dom, padDoc, subject, me, options)).toBe(element)
})
it('should log error that you need to be logged in for pad to be edited', () => {
const padDoc = null
const subject = null
const me = null
const options = {}
;(window as any).console = { log: jest.fn() }
expect((pad as any).notepad(dom, padDoc, subject, me, options)).toBe(element)
expect(console.log).toBeCalledWith('Warning: must be logged in for pad to be edited')
})
})