30 行
938 B
TypeScript
30 行
938 B
TypeScript
|
|
import assert from 'node:assert/strict'
|
||
|
|
import test from 'node:test'
|
||
|
|
|
||
|
|
import { selectStackModuleId } from '../src/bundleIdentityPolicy'
|
||
|
|
|
||
|
|
const modules = {
|
||
|
|
common: { bundleFile: 'common.android.bundle' },
|
||
|
|
app: { bundleFile: 'app.android.bundle' },
|
||
|
|
orders: { bundleFile: 'orders.android.bundle' },
|
||
|
|
}
|
||
|
|
|
||
|
|
test('stack identity resolves only one exact active or embedded bundle', () => {
|
||
|
|
assert.equal(
|
||
|
|
selectStackModuleId(
|
||
|
|
'at render (/data/user/0/host/files/rn-bundles/orders/active.bundle:10:20)',
|
||
|
|
modules,
|
||
|
|
),
|
||
|
|
'orders',
|
||
|
|
)
|
||
|
|
assert.equal(
|
||
|
|
selectStackModuleId('at boot (/assets/rn-bundles/app.android.bundle:1:2)', modules),
|
||
|
|
'app',
|
||
|
|
)
|
||
|
|
})
|
||
|
|
|
||
|
|
test('stack identity stays unavailable for unknown or ambiguous sources', () => {
|
||
|
|
assert.equal(selectStackModuleId('at render (index.js:10:20)', modules), null)
|
||
|
|
assert.equal(selectStackModuleId('app.android.bundle -> orders.android.bundle', modules), null)
|
||
|
|
})
|