-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
35 lines (28 loc) · 760 Bytes
/
Copy pathtest.js
File metadata and controls
35 lines (28 loc) · 760 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
26
27
28
29
30
31
32
33
34
35
const test = require('brittle')
const target = require('.')
const client = {
source: `const { default: RPC } = await import('bare-rpc')
const router = new RPC.CommandRouter()
const rpc = new RPC(ipc, router)
rpc.respond = router.respond.bind(router)
`,
type: "import('bare-rpc')"
}
function snapshot(t, bundleSpecifier, client = null) {
const [harness, types] = target.generate({
bundleSpecifier,
ipc: 'ipc',
rpc: 'rpc',
client
})
t.snapshot(harness.source, 'harness')
t.snapshot(types.source, 'types')
}
test('generate', (t) => {
t.is(target.name, 'react-native')
t.is(target.format, 'bundle.mjs')
snapshot(t, './core.bundle.mjs')
})
test('generate with client', (t) => {
snapshot(t, './core.bundle.mjs', client)
})