forked from SolidOS/solid-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.ts
More file actions
25 lines (20 loc) · 716 Bytes
/
setup.ts
File metadata and controls
25 lines (20 loc) · 716 Bytes
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
import { toContainGraph } from '../custom-matchers/toContainGraph'
import { toEqualGraph } from '../custom-matchers/toEqualGraph'
import 'isomorphic-fetch'
import { TextEncoder, TextDecoder } from 'util'
// https://stackoverflow.com/questions/52612122/how-to-use-jest-to-test-functions-using-crypto-or-window-mscrypto
import crypto from 'crypto'
global.crypto = {
getRandomValues: function (buffer) {
return crypto.randomFillSync(buffer)
}
}
global.TextEncoder = TextEncoder
global.TextDecoder = TextDecoder
// Mock external dependencies that solid-logic expects
jest.mock('$rdf', () => require('rdflib'), { virtual: true })
// adding custom matchers
expect.extend({
toContainGraph,
toEqualGraph
})