diff --git a/.storybook/preview.tsx b/.storybook/preview.tsx index d63e764ef..5e343e8ee 100644 --- a/.storybook/preview.tsx +++ b/.storybook/preview.tsx @@ -42,6 +42,16 @@ const preview: Preview = { description: 'Seam Endpoint', defaultValue: process.env['STORYBOOK_SEAM_ENDPOINT'] ?? '/api', }, + simulatedOutage: { + description: 'Simulate an outage', + defaultValue: 'normal', + toolbar: { + items: [ + { value: 'normal', icon: 'lightning', title: 'Normal' }, + { value: 'outage', icon: 'lightningoff', title: 'Outage' }, + ], + }, + }, }, parameters: { actions: { argTypesRegex: '^on[A-Z].*' }, @@ -55,11 +65,20 @@ const preview: Preview = { decorators: [ ( Story, - { globals: { publishableKey, userIdentifierKey, seamEndpoint } } + { + globals: { + publishableKey, + userIdentifierKey, + seamEndpoint, + simulatedOutage, + }, + } ) => { return ( { created_at: '2023-05-15T14:07:48.000', }) + const ws3 = db.addWorkspace({ + name: 'Seed Workspace 3 (simulated outage)', + publishable_key: 'seam_pk_3', + created_at: '2023-05-15T14:07:48.000', + }) + + db.simulateWorkspaceOutage(ws3.workspace_id) + const cw = db.addConnectWebview({ workspace_id: ws2.workspace_id, created_at: '2023-05-15T15:08:49.000', diff --git a/package-lock.json b/package-lock.json index d78597d5c..8a26b1b46 100644 --- a/package-lock.json +++ b/package-lock.json @@ -22,7 +22,7 @@ "@mui/icons-material": "^5.11.16", "@mui/material": "^5.12.2", "@rxfork/r2wc-react-to-web-component": "^2.3.0", - "@seamapi/fake-seam-connect": "^1.14.0", + "@seamapi/fake-seam-connect": "^1.17.0", "@storybook/addon-designs": "^7.0.1", "@storybook/addon-essentials": "^7.0.2", "@storybook/addon-links": "^7.0.2", @@ -4500,9 +4500,9 @@ } }, "node_modules/@seamapi/fake-seam-connect": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/@seamapi/fake-seam-connect/-/fake-seam-connect-1.15.0.tgz", - "integrity": "sha512-BsHq/SetsHkQw/eS/nk9AlRRHTaiQUEQ3sfwNrTVoLyqkkt3AXtdhvMrj7K/cHAK8nu/kVYXgJPbwJRSfGCz5g==", + "version": "1.17.0", + "resolved": "https://registry.npmjs.org/@seamapi/fake-seam-connect/-/fake-seam-connect-1.17.0.tgz", + "integrity": "sha512-WKZ0HUI6y5Q025rMh1It15i8JMz8gXoC3Km81NNss0R0Jl5ubMNGKlUOO1MetXkhTc5pa3i1ARORS/AXYZ94HQ==", "dev": true, "bin": { "fake-seam-connect": "dist/server.js" diff --git a/package.json b/package.json index 52f80dbfc..13eb74579 100644 --- a/package.json +++ b/package.json @@ -134,7 +134,7 @@ "@mui/icons-material": "^5.11.16", "@mui/material": "^5.12.2", "@rxfork/r2wc-react-to-web-component": "^2.3.0", - "@seamapi/fake-seam-connect": "^1.14.0", + "@seamapi/fake-seam-connect": "^1.17.0", "@storybook/addon-designs": "^7.0.1", "@storybook/addon-essentials": "^7.0.2", "@storybook/addon-links": "^7.0.2", diff --git a/test/fixtures/seed-fake.ts b/test/fixtures/seed-fake.ts index 721ddae57..5e15b6ea0 100644 --- a/test/fixtures/seed-fake.ts +++ b/test/fixtures/seed-fake.ts @@ -9,6 +9,9 @@ interface Seed { export const seedFake = async (db: Database): Promise => { const ws1 = db.addWorkspace({ name: 'Seed Workspace 1 (starts empty)' }) const ws2 = db.addWorkspace({ name: 'Seed Workspace 2 (starts populated)' }) + const ws3 = db.addWorkspace({ name: 'Seed Workspace 3 (simulated outage)' }) + + db.simulateWorkspaceOutage(ws3.workspace_id) const cw = db.addConnectWebview({ workspace_id: ws2.workspace_id,