import assert from 'node:assert/strict' import test from 'node:test' test('the browser half waits for the Settings slot declaration', async () => { const previousWindow = globalThis.window let handoff globalThis.window = { __ModuleLoader__: { load(next) { handoff = next }, }, } try { await import(`../lib/client.js?test=${Date.now()}`) assert.notEqual(handoff, undefined) const React = { createElement() {}, useEffect() {}, useState() {}, } const browserPlugin = handoff.factory(id => { assert.equal(id, 'react') return React }) const calls = [] const ctx = { slots: { inject(key, callback) { calls.push(`inject:${key}`) return callback() }, register(options) { calls.push(`register:${options.name}:${options.id}`) return () => {} }, }, } browserPlugin.apply(ctx) assert.deepEqual(calls, [ 'inject:settings.plugins.tab', 'register:settings.plugins.tab:session-isolation', ]) } finally { if (previousWindow === undefined) delete globalThis.window else globalThis.window = previousWindow } })