UNPKG

1.66 kBJavaScriptView Raw
1require('raf').polyfill(global)
2global.DEBUG = process.env.DEBUG || process.env.debug
3
4global.subscribe = null
5global.serverModel = null
6global.Simple = null
7global.Complex = null
8global.model = null
9global.subDoc = null
10global.subQuery = null
11global.subLocal = null
12global.subValue = null
13global.subApi = null
14global.HooksComplex = null
15global.HooksSimple = null
16global.useDoc = null
17global.useQuery = null
18global.useLocal = null
19global.useValue = null
20global.useApi = null
21
22global.globalTestRenderer = null
23global.globalEnzymeNode = null
24
25export function asyncImport () {
26 global.serverModel = require('./_client/initRpc')
27 global.subscribe = require('..').subscribe
28 global.model = require('..').model
29 global.Simple = require('./stubs/Simple')
30 global.Complex = require('./stubs/Complex')
31 global.subValue = require('..').subValue
32 global.subDoc = require('..').subDoc
33 global.subQuery = require('..').subQuery
34 global.subLocal = require('..').subLocal
35 global.subApi = require('..').subApi
36 global.HooksComplex = require('./stubs/HooksComplex')
37 global.HooksSimple = require('./stubs/HooksSimple')
38 global.useValue = require('..').useValue
39 global.useDoc = require('..').useDoc
40 global.useQuery = require('..').useQuery
41 global.useLocal = require('..').useLocal
42 global.useApi = require('..').useApi
43}
44
45export function cleanup () {
46 if (global.globalEnzymeNode && global.globalEnzymeNode.unmount) {
47 global.globalEnzymeNode.unmount()
48 global.globalEnzymeNode = undefined
49 }
50 if (global.globalTestRenderer && global.globalTestRenderer.unmount) {
51 global.globalTestRenderer.unmount()
52 global.globalTestRenderer = undefined
53 }
54}