mirror of
https://github.com/coder/coder.git
synced 2025-07-23 21:32:07 +00:00
refactor(site): replace UserContext with userXService (#465)
* Install and configure XState * userXService - typegen not working yet * Lint, fix error transitions * Lint * Change initial state to handle loss of state * Fix gitignore * Fix types by hook or by crook * Use xservice in all pages * Glue/visual component separation * Fix dependency merge * Lint * Remove UserContext * Remove inspector * Add typegen command to site/out * Fix index page redirects * DRY up nav and redirects * Moves based on merge * Moving Page helpers into Page dir * Move xservice into src, update script * Move and storybook navbarview * Update docs * Install MSW * Reorganization, with apologies * Missed spots * Add mock handlers * Configure jest for msw * Fix typos * Shift unit test to NavbarView * Fix test types * Rename NavbarView test * Attempt at test, wip * Fix config * Be logged out, only warn * Conditionally show text to help test * Use a Context for MSW's sake * mocks -> test_helpers * Enable dev tools * Format * Fix import * Fixes * Lint * run typegen postinstall Co-authored-by: Bryan Phelps <bryan@coder.com>
This commit is contained in:
@ -1,3 +1,19 @@
|
||||
import { server } from "./src/test_helpers/server"
|
||||
|
||||
// Establish API mocking before all tests through MSW.
|
||||
beforeAll(() =>
|
||||
server.listen({
|
||||
onUnhandledRequest: "warn",
|
||||
}),
|
||||
)
|
||||
|
||||
// Reset any request handlers that we may add during the tests,
|
||||
// so they don't affect other tests.
|
||||
afterEach(() => server.resetHandlers())
|
||||
|
||||
// Clean up after the tests are finished.
|
||||
afterAll(() => server.close())
|
||||
|
||||
// Helper utility to fail jest tests if a console.error is logged
|
||||
// Pulled from this blog post:
|
||||
// https://www.benmvp.com/blog/catch-warnings-jest-tests/
|
||||
|
Reference in New Issue
Block a user