1
0
Эх сурвалжийг харах

test(host): cover the non-Error late-conflict wrap

creatixchu 2 сар өмнө
parent
commit
62db16f81a

+ 13 - 0
packages/host/directory-picker-native/tests/client-flow.spec.tsx

@@ -78,6 +78,19 @@ describe('directory-picker-native client half', () => {
       // surfaced the conflict on the fail-loud channel — no partial mix.
       for (const hole of HOLES) expect(b.slots.entries(hole)).toHaveLength(1)
       expect(rejections.map(String).join('\n')).toContain('already has a registration')
+
+      // Non-Error conflicts wrap before the loud rethrow (same channel).
+      const c = await bench()
+      await c.ctx.plugin({ inject: [...inject], apply }).await()
+      const original = c.slots.register.bind(c.slots)
+      const slotsAny = c.slots as { register: typeof original }
+      slotsAny.register = ((options: never, component: never) => {
+        if ((options as { name?: string }).name === HOLES[0]) throw 'string conflict'
+        return original(options, component)
+      }) as typeof original
+      c.declare()
+      await new Promise(resolve => setTimeout(resolve, 20))
+      expect(rejections.map(String).join('\n')).toContain('string conflict')
     } finally {
       process.off('unhandledRejection', onUnhandled)
       process.off('uncaughtException', onUnhandled)