Skip to content

Commit 2620fc9

Browse files
get selectorPanel function to pass with dom helper
1 parent dca2081 commit 2620fc9

2 files changed

Lines changed: 55 additions & 32 deletions

File tree

test/helpers/dom.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
export const dom = {
2+
createElement() {
3+
return {}
4+
}
5+
}

test/unit/widgets/buttons.test.ts

Lines changed: 50 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ jest.mock('rdflib')
22
import * as RdfLib from 'rdflib'
33
jest.mock('solid-auth-client')
44
import * as SolidAuthClient from 'solid-auth-client'
5+
import { dom } from '../../helpers/dom'
56

67
import {
78
addStyleSheet,
@@ -42,7 +43,7 @@ import {
4243
} from '../../../src/widgets/buttons'
4344

4445
describe('addStyleSheet', () => {
45-
it.only('exists', () => {
46+
it('exists', () => {
4647
expect(addStyleSheet).toBeInstanceOf(Function)
4748
})
4849
it('runs', () => {
@@ -69,7 +70,7 @@ describe('allClassURIs', () => {
6970
expect(allClassURIs).toBeInstanceOf(Function)
7071
})
7172
it('runs', () => {
72-
expect(allClassURIs()).toEqual({})
73+
expect(allClassURIs()).toBeTruthy()
7374
})
7475

7576
})
@@ -96,7 +97,7 @@ describe('askName', () => {
9697
const predicate = {}
9798
const klass = {}
9899
const noun = {}
99-
expect(await askName(dom, kb, container, predicate, klass, noun)).toEqual({})
100+
expect(await askName(dom, kb, container, predicate, klass, noun)).toBeTruthy()
100101
})
101102
})
102103

@@ -105,7 +106,7 @@ describe('attachmentList', () => {
105106
expect(attachmentList).toBeInstanceOf(Function)
106107
})
107108
it('runs', () => {
108-
expect(attachmentList()).toEqual({})
109+
expect(attachmentList()).toBeTruthy()
109110
})
110111
})
111112

@@ -114,7 +115,7 @@ describe('button', () => {
114115
expect(button).toBeInstanceOf(Function)
115116
})
116117
it('runs', () => {
117-
expect(button()).toEqual({})
118+
expect(button()).toBeTruthy()
118119
})
119120
})
120121

@@ -123,7 +124,7 @@ describe('cancelButton', () => {
123124
expect(cancelButton).toBeInstanceOf(Function)
124125
})
125126
it('runs', () => {
126-
expect(cancelButton()).toEqual({})
127+
expect(cancelButton()).toBeTruthy()
127128
})
128129
})
129130

@@ -132,7 +133,7 @@ describe('clearElement', () => {
132133
expect(clearElement).toBeInstanceOf(Function)
133134
})
134135
it('runs', () => {
135-
expect(clearElement()).toEqual({})
136+
expect(clearElement()).toBeTruthy()
136137
})
137138
})
138139

@@ -141,7 +142,7 @@ describe('complain', () => {
141142
expect(complain).toBeInstanceOf(Function)
142143
})
143144
it('runs', () => {
144-
expect(complain()).toEqual({})
145+
expect(complain()).toBeTruthy()
145146
})
146147
})
147148

@@ -150,7 +151,7 @@ describe('continueButton', () => {
150151
expect(continueButton).toBeInstanceOf(Function)
151152
})
152153
it('runs', () => {
153-
expect(continueButton()).toEqual({})
154+
expect(continueButton()).toBeTruthy()
154155
})
155156
})
156157

@@ -159,7 +160,7 @@ describe('defaultAnnotationStore', () => {
159160
expect(defaultAnnotationStore).toBeInstanceOf(Function)
160161
})
161162
it('runs', () => {
162-
expect(defaultAnnotationStore()).toEqual({})
163+
expect(defaultAnnotationStore()).toBeTruthy()
163164
})
164165
})
165166

@@ -168,7 +169,7 @@ describe('deleteButtonWithCheck', () => {
168169
expect(deleteButtonWithCheck).toBeInstanceOf(Function)
169170
})
170171
it('runs', () => {
171-
expect(deleteButtonWithCheck()).toEqual({})
172+
expect(deleteButtonWithCheck()).toBeTruthy()
172173
})
173174
})
174175

@@ -177,7 +178,7 @@ describe('extractLogURI', () => {
177178
expect(extractLogURI).toBeInstanceOf(Function)
178179
})
179180
it('runs', () => {
180-
expect(extractLogURI()).toEqual({})
181+
expect(extractLogURI()).toBeTruthy()
181182
})
182183
})
183184

@@ -186,7 +187,7 @@ describe('findImage', () => {
186187
expect(findImage).toBeInstanceOf(Function)
187188
})
188189
it('runs', () => {
189-
expect(findImage()).toEqual({})
190+
expect(findImage()).toBeTruthy()
190191
})
191192
})
192193

@@ -195,7 +196,7 @@ describe('findImageFromURI', () => {
195196
expect(findImageFromURI).toBeInstanceOf(Function)
196197
})
197198
it('runs', () => {
198-
expect(findImageFromURI()).toEqual({})
199+
expect(findImageFromURI()).toBeTruthy()
199200
})
200201
})
201202

@@ -204,7 +205,7 @@ describe('fileUploadButtonDiv', () => {
204205
expect(fileUploadButtonDiv).toBeInstanceOf(Function)
205206
})
206207
it('runs', () => {
207-
expect(fileUploadButtonDiv({}, {})).toEqual({})
208+
expect(fileUploadButtonDiv({}, {})).toBeTruthy()
208209
})
209210
})
210211

@@ -213,7 +214,7 @@ describe('formatDateTime', () => {
213214
expect(formatDateTime).toBeInstanceOf(Function)
214215
})
215216
it('runs', () => {
216-
expect(formatDateTime()).toEqual({})
217+
expect(formatDateTime()).toBeTruthy()
217218
})
218219
})
219220

@@ -222,7 +223,7 @@ describe('imagesOf', () => {
222223
expect(imagesOf).toBeInstanceOf(Function)
223224
})
224225
it('runs', () => {
225-
expect(imagesOf()).toEqual({})
226+
expect(imagesOf()).toBeTruthy()
226227
})
227228
})
228229

@@ -294,7 +295,7 @@ describe('linkButton', () => {
294295
expect(linkButton).toBeInstanceOf(Function)
295296
})
296297
it('runs', () => {
297-
expect(linkButton()).toEqual({})
298+
expect(linkButton()).toBeTruthy()
298299
})
299300
})
300301

@@ -303,7 +304,7 @@ describe('linkIcon', () => {
303304
expect(linkIcon).toBeInstanceOf(Function)
304305
})
305306
it('runs', () => {
306-
expect(linkIcon()).toEqual({})
307+
expect(linkIcon()).toBeTruthy()
307308
})
308309
})
309310

@@ -312,7 +313,7 @@ describe('openHrefInOutlineMode', () => {
312313
expect(openHrefInOutlineMode).toBeInstanceOf(Function)
313314
})
314315
it('runs', () => {
315-
expect(openHrefInOutlineMode()).toEqual({})
316+
expect(openHrefInOutlineMode()).toBeTruthy()
316317
})
317318
})
318319

@@ -321,7 +322,7 @@ describe('personTR', () => {
321322
expect(personTR).toBeInstanceOf(Function)
322323
})
323324
it('runs', () => {
324-
expect(personTR()).toEqual({})
325+
expect(personTR()).toBeTruthy()
325326
})
326327
})
327328

@@ -330,7 +331,7 @@ describe('propertyTriage', () => {
330331
expect(propertyTriage).toBeInstanceOf(Function)
331332
})
332333
it('runs', () => {
333-
expect(propertyTriage({})).toEqual({})
334+
expect(propertyTriage({})).toBeTruthy()
334335
})
335336
})
336337

@@ -339,7 +340,7 @@ describe('refreshTree', () => {
339340
expect(refreshTree).toBeInstanceOf(Function)
340341
})
341342
it('runs', () => {
342-
expect(refreshTree()).toEqual({})
343+
expect(refreshTree()).toBeTruthy()
343344
})
344345
})
345346

@@ -348,16 +349,33 @@ describe('removeButton', () => {
348349
expect(removeButton).toBeInstanceOf(Function)
349350
})
350351
it('runs', () => {
351-
expect(removeButton()).toEqual({})
352+
expect(removeButton()).toBeTruthy()
352353
})
353354
})
354355

355356
describe('selectorPanel', () => {
356357
it('exists', () => {
357358
expect(selectorPanel).toBeInstanceOf(Function)
358359
})
359-
it('runs', () => {
360-
expect(selectorPanel()).toEqual({})
360+
it.only('runs', () => {
361+
const kb = RdfLib.graph()
362+
const type = ''
363+
const predicate = ''
364+
const inverse = false
365+
const possible = true
366+
const options = {}
367+
const callbackFunction = () => {}
368+
const linkCallback = () => {}
369+
expect(selectorPanel(
370+
dom,
371+
kb,
372+
type,
373+
predicate,
374+
inverse,
375+
possible,
376+
options,
377+
callbackFunction,
378+
linkCallback)).toBeTruthy()
361379
})
362380
})
363381

@@ -366,7 +384,7 @@ describe('selectorPanelRefresh', () => {
366384
expect(selectorPanelRefresh).toBeInstanceOf(Function)
367385
})
368386
it('runs', () => {
369-
expect(selectorPanelRefresh()).toEqual({})
387+
expect(selectorPanelRefresh()).toBeTruthy()
370388
})
371389
})
372390

@@ -375,7 +393,7 @@ describe('setImage', () => {
375393
expect(setImage).toBeInstanceOf(Function)
376394
})
377395
it('runs', () => {
378-
expect(setImage()).toEqual({})
396+
expect(setImage()).toBeTruthy()
379397
})
380398
})
381399

@@ -384,7 +402,7 @@ describe('setName', () => {
384402
expect(setName).toBeInstanceOf(Function)
385403
})
386404
it('runs', () => {
387-
expect(setName()).toEqual({})
405+
expect(setName()).toBeTruthy()
388406
})
389407
})
390408

@@ -393,7 +411,7 @@ describe('shortDate', () => {
393411
expect(shortDate).toBeInstanceOf(Function)
394412
})
395413
it('runs', () => {
396-
expect(shortDate()).toEqual({})
414+
expect(shortDate()).toBeTruthy()
397415
})
398416
})
399417

@@ -402,7 +420,7 @@ describe('shortTime', () => {
402420
expect(shortTime).toBeInstanceOf(Function)
403421
})
404422
it('runs', () => {
405-
expect(shortTime()).toEqual({})
423+
expect(shortTime()).toBeTruthy()
406424
})
407425
})
408426

@@ -411,7 +429,7 @@ describe('timestamp', () => {
411429
expect(timestamp).toBeInstanceOf(Function)
412430
})
413431
it('runs', () => {
414-
expect(timestamp()).toEqual({})
432+
expect(timestamp()).toBeTruthy()
415433
})
416434
})
417435

0 commit comments

Comments
 (0)