| 41 | } |
| 42 | |
| 43 | constructor(name: string, opts: Partial<BootArgs> = {}) { |
| 44 | beforeAll(async () => { |
| 45 | this.network.listen({ |
| 46 | onUnhandledRequest: (req) => { |
| 47 | if (req.url.host.startsWith("localhost:")) return // Allow requests to a localhost server |
| 48 | throw new Error( |
| 49 | `Unhandled External Request: ${req.method} ${req.url.href}` |
| 50 | ) |
| 51 | }, |
| 52 | }) |
| 53 | this.assign(await boot(name, opts)) |
| 54 | this.store.dispatch(Tabs.create()) |
| 55 | }) |
| 56 | |
| 57 | afterEach(() => this.network.resetHandlers()) |
| 58 | |
| 59 | afterAll(async () => { |
| 60 | teardown() |
| 61 | if (this.initialized) { |
| 62 | await this.main.stop() |
| 63 | tl.cleanup() |
| 64 | this.network.close() |
| 65 | } |
| 66 | }) |
| 67 | } |
| 68 | |
| 69 | navTo(path: string) { |
| 70 | Current.getHistory(this.store.getState()).push(path) |