Skip to content

Commit 8cbcb4b

Browse files
use jsdom
1 parent 0c130fe commit 8cbcb4b

39 files changed

Lines changed: 6224 additions & 2590 deletions

package-lock.json

Lines changed: 6107 additions & 2432 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,12 +72,14 @@
7272
"@babel/preset-env": "^7.6.2",
7373
"@babel/preset-typescript": "^7.6.0",
7474
"@types/jest": "^25.1.1",
75+
"@types/jsdom": "^12.2.4",
7576
"@types/rdflib": "^0.20.1",
7677
"@typescript-eslint/eslint-plugin": "^2.7.0",
7778
"@typescript-eslint/parser": "^2.6.1",
7879
"eslint": "^6.6.0",
7980
"husky": "^3.0.9",
8081
"jest": "^25.1.0",
82+
"jsdom": "^16.1.0",
8183
"lint-staged": "^10.0.0-1",
8284
"standard": "^14.3.1",
8385
"typedoc": "^0.16.9",

test/helpers/dom.ts

Lines changed: 0 additions & 38 deletions
This file was deleted.

test/unit/acl/access-controller.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
jest.mock('rdflib')
22
import * as RdfLib from 'rdflib'
33
jest.mock('solid-auth-client')
4-
import * as SolidAuthClient from 'solid-auth-client'
5-
import { element, dom } from '../../helpers/dom'
4+
import { JSDOM } from 'jsdom'
5+
const dom = new JSDOM('<!DOCTYPE html><p>Hello world</p>').window.document
66

77
import { AccessController } from '../../../src/acl/access-controller'
88
import { DataBrowserContext } from 'pane-registry'
@@ -11,7 +11,7 @@ function instantiateAccessController() {
1111
const subject = RdfLib.sym('')
1212
const noun = ''
1313
const context = {} as DataBrowserContext
14-
const statusElement = element as unknown as HTMLElement
14+
const statusElement = dom.createElement('div')
1515
const classes = {}
1616
const targetIsProtected = false
1717
const targetDoc = RdfLib.sym('')
@@ -56,7 +56,7 @@ describe('AccessController#render', () => {
5656
expect(instantiateAccessController().render).toBeInstanceOf(Function)
5757
})
5858
it('runs', () => {
59-
expect(instantiateAccessController().render()).toEqual(element)
59+
expect(instantiateAccessController().render()).toBeTruthy()
6060
})
6161
})
6262

test/unit/acl/access-groups.test.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
jest.mock('rdflib')
2-
import * as RdfLib from 'rdflib'
32
jest.mock('solid-auth-client')
4-
import * as SolidAuthClient from 'solid-auth-client'
53

64
import * as AccessGroups from '../../../src/acl/access-groups'
75

test/unit/acl/acl-control.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
jest.mock('rdflib')
2-
import * as RdfLib from 'rdflib'
32
jest.mock('solid-auth-client')
4-
import * as SolidAuthClient from 'solid-auth-client'
3+
import { JSDOM } from 'jsdom'
4+
const dom = new JSDOM('<!DOCTYPE html><p>Hello world</p>').window.document
55

66
import {
77
ACLControlBox5,

test/unit/acl/acl.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
jest.mock('rdflib')
2-
import * as RdfLib from 'rdflib'
32
jest.mock('solid-auth-client')
4-
import * as SolidAuthClient from 'solid-auth-client'
3+
import { JSDOM } from 'jsdom'
4+
const dom = new JSDOM('<!DOCTYPE html><p>Hello world</p>').window.document
55

66
import {
77
ACLbyCombination,

test/unit/acl/add-agent-buttons.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
jest.mock('rdflib')
2-
import * as RdfLib from 'rdflib'
32
jest.mock('solid-auth-client')
4-
import * as SolidAuthClient from 'solid-auth-client'
3+
import { JSDOM } from 'jsdom'
4+
const dom = new JSDOM('<!DOCTYPE html><p>Hello world</p>').window.document
55

66
import * as AddAgentButtons from '../../../src/acl/add-agent-buttons'
77

test/unit/acl/index.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
jest.mock('rdflib')
2-
import * as RdfLib from 'rdflib'
32
jest.mock('solid-auth-client')
4-
import * as SolidAuthClient from 'solid-auth-client'
3+
import { JSDOM } from 'jsdom'
4+
const dom = new JSDOM('<!DOCTYPE html><p>Hello world</p>').window.document
55

66
import * as Acl from '../../../src/acl/acl'
77
import * as AclControl from '../../../src/acl/acl-control'

test/unit/acl/styles.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
jest.mock('rdflib')
2-
import * as RdfLib from 'rdflib'
32
jest.mock('solid-auth-client')
4-
import * as SolidAuthClient from 'solid-auth-client'
3+
import { JSDOM } from 'jsdom'
4+
const dom = new JSDOM('<!DOCTYPE html><p>Hello world</p>').window.document
55

66
import * as Styles from '../../../src/acl/styles'
77

0 commit comments

Comments
 (0)