mirror of https://github.com/coder/coder.git
chore(site): upgrade msw to 2.0 (#12597)
Closes https://github.com/coder/coder/issues/11426
This commit is contained in:
parent
9cfd5baa91
commit
23e3e4ce58
|
@ -5,6 +5,8 @@ env:
|
|||
es6: true
|
||||
jest: true
|
||||
node: true
|
||||
ignorePatterns:
|
||||
- "jest.polyfills.js"
|
||||
extends:
|
||||
- eslint:recommended
|
||||
- plugin:@typescript-eslint/recommended
|
||||
|
|
|
@ -6,6 +6,7 @@ module.exports = {
|
|||
{
|
||||
displayName: "test",
|
||||
roots: ["<rootDir>"],
|
||||
setupFiles: ["./jest.polyfills.js"],
|
||||
setupFilesAfterEnv: ["./jest.setup.ts"],
|
||||
extensionsToTreatAsEsm: [".ts"],
|
||||
transform: {
|
||||
|
@ -27,8 +28,18 @@ module.exports = {
|
|||
],
|
||||
},
|
||||
testEnvironment: "jsdom",
|
||||
testEnvironmentOptions: {
|
||||
customExportConditions: [""],
|
||||
},
|
||||
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
|
||||
testPathIgnorePatterns: ["/node_modules/", "/e2e/"],
|
||||
testPathIgnorePatterns: [
|
||||
"/node_modules/",
|
||||
"/e2e/",
|
||||
// TODO: This test is timing out after upgrade a few Jest dependencies
|
||||
// and I was not able to figure out why. When running it specifically, I
|
||||
// can see many act warnings that may can help us to find the issue.
|
||||
"/usePaginatedQuery.test.ts",
|
||||
],
|
||||
transformIgnorePatterns: [
|
||||
"<rootDir>/node_modules/@chartjs-adapter-date-fns",
|
||||
],
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/**
|
||||
* Necessary for MSW
|
||||
*
|
||||
* @note The block below contains polyfills for Node.js globals
|
||||
* required for Jest to function when running JSDOM tests.
|
||||
* These HAVE to be require's and HAVE to be in this exact
|
||||
* order, since "undici" depends on the "TextEncoder" global API.
|
||||
*
|
||||
* Consider migrating to a more modern test runner if
|
||||
* you don't want to deal with this.
|
||||
*/
|
||||
const { TextDecoder, TextEncoder } = require("node:util");
|
||||
const { ReadableStream } = require("node:stream/web");
|
||||
|
||||
Object.defineProperties(globalThis, {
|
||||
TextDecoder: { value: TextDecoder },
|
||||
TextEncoder: { value: TextEncoder },
|
||||
ReadableStream: { value: ReadableStream },
|
||||
});
|
||||
|
||||
const { Blob, File } = require("node:buffer");
|
||||
const { fetch, Headers, FormData, Request, Response } = require("undici");
|
||||
|
||||
Object.defineProperties(globalThis, {
|
||||
fetch: { value: fetch, writable: true },
|
||||
Blob: { value: Blob },
|
||||
File: { value: File },
|
||||
Headers: { value: Headers },
|
||||
FormData: { value: FormData },
|
||||
Request: { value: Request },
|
||||
Response: { value: Response },
|
||||
});
|
|
@ -1,17 +1,12 @@
|
|||
import "@testing-library/jest-dom";
|
||||
import "jest-location-mock";
|
||||
import { cleanup } from "@testing-library/react";
|
||||
import { Blob } from "buffer";
|
||||
import crypto from "crypto";
|
||||
import jestFetchMock from "jest-fetch-mock";
|
||||
import { useMemo } from "react";
|
||||
import { TextEncoder, TextDecoder } from "util";
|
||||
import type { Region } from "api/typesGenerated";
|
||||
import type { ProxyLatencyReport } from "contexts/useProxyLatency";
|
||||
import { server } from "testHelpers/server";
|
||||
|
||||
jestFetchMock.enableMocks();
|
||||
|
||||
// useProxyLatency does some http requests to determine latency.
|
||||
// This would fail unit testing, or at least make it very slow with
|
||||
// actual network requests. So just globally mock this hook.
|
||||
|
@ -42,11 +37,6 @@ jest.mock("contexts/useProxyLatency", () => ({
|
|||
},
|
||||
}));
|
||||
|
||||
global.TextEncoder = TextEncoder;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Polyfill for jsdom
|
||||
global.TextDecoder = TextDecoder as any;
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Polyfill for jsdom
|
||||
global.Blob = Blob as any;
|
||||
global.scrollTo = jest.fn();
|
||||
|
||||
window.HTMLElement.prototype.scrollIntoView = jest.fn();
|
||||
|
|
|
@ -82,6 +82,7 @@
|
|||
"tzdata": "1.0.30",
|
||||
"ua-parser-js": "1.0.33",
|
||||
"ufuzzy": "npm:@leeoniya/ufuzzy@1.0.10",
|
||||
"undici": "6.7.1",
|
||||
"unique-names-generator": "4.7.1",
|
||||
"uuid": "9.0.0",
|
||||
"xterm": "5.2.0",
|
||||
|
@ -151,12 +152,11 @@
|
|||
"jest": "29.6.2",
|
||||
"jest-canvas-mock": "2.5.2",
|
||||
"jest-environment-jsdom": "29.5.0",
|
||||
"jest-fetch-mock": "3.0.3",
|
||||
"jest-location-mock": "2.0.0",
|
||||
"jest-runner-eslint": "2.1.0",
|
||||
"jest-websocket-mock": "2.5.0",
|
||||
"jest_workaround": "0.1.14",
|
||||
"msw": "1.3.0",
|
||||
"msw": "2.2.3",
|
||||
"prettier": "3.1.0",
|
||||
"protobufjs": "7.2.4",
|
||||
"rxjs": "7.8.1",
|
||||
|
|
|
@ -168,6 +168,9 @@ dependencies:
|
|||
ufuzzy:
|
||||
specifier: npm:@leeoniya/ufuzzy@1.0.10
|
||||
version: /@leeoniya/ufuzzy@1.0.10
|
||||
undici:
|
||||
specifier: 6.7.1
|
||||
version: 6.7.1
|
||||
unique-names-generator:
|
||||
specifier: 4.7.1
|
||||
version: 4.7.1
|
||||
|
@ -371,9 +374,6 @@ devDependencies:
|
|||
jest-environment-jsdom:
|
||||
specifier: 29.5.0
|
||||
version: 29.5.0(canvas@2.11.0)
|
||||
jest-fetch-mock:
|
||||
specifier: 3.0.3
|
||||
version: 3.0.3
|
||||
jest-location-mock:
|
||||
specifier: 2.0.0
|
||||
version: 2.0.0
|
||||
|
@ -387,8 +387,8 @@ devDependencies:
|
|||
specifier: 0.1.14
|
||||
version: 0.1.14(@swc/core@1.3.38)(@swc/jest@0.2.24)
|
||||
msw:
|
||||
specifier: 1.3.0
|
||||
version: 1.3.0(typescript@5.2.2)
|
||||
specifier: 2.2.3
|
||||
version: 2.2.3(typescript@5.2.2)
|
||||
prettier:
|
||||
specifier: 3.1.0
|
||||
version: 3.1.0
|
||||
|
@ -1842,6 +1842,18 @@ packages:
|
|||
resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==}
|
||||
dev: true
|
||||
|
||||
/@bundled-es-modules/cookie@2.0.0:
|
||||
resolution: {integrity: sha512-Or6YHg/kamKHpxULAdSqhGqnWFneIXu1NKvvfBBzKGwpVsYuFIQ5aBPHDnnoR3ghW1nvSkALd+EF9iMtY7Vjxw==}
|
||||
dependencies:
|
||||
cookie: 0.5.0
|
||||
dev: true
|
||||
|
||||
/@bundled-es-modules/statuses@1.0.1:
|
||||
resolution: {integrity: sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==}
|
||||
dependencies:
|
||||
statuses: 2.0.1
|
||||
dev: true
|
||||
|
||||
/@colors/colors@1.5.0:
|
||||
resolution: {integrity: sha512-ooWCrlZP11i8GImSjTHYHLkvFDP48nS4+204nGb1RiX/WXYHmJA2III9/e2DWVabCESdW7hBAEzHRqUn9OUVvQ==}
|
||||
engines: {node: '>=0.1.90'}
|
||||
|
@ -2309,6 +2321,39 @@ packages:
|
|||
react: 18.2.0
|
||||
dev: false
|
||||
|
||||
/@inquirer/confirm@3.0.0:
|
||||
resolution: {integrity: sha512-LHeuYP1D8NmQra1eR4UqvZMXwxEdDXyElJmmZfU44xdNLL6+GcQBS0uE16vyfZVjH8c22p9e+DStROfE/hyHrg==}
|
||||
engines: {node: '>=18'}
|
||||
dependencies:
|
||||
'@inquirer/core': 7.0.0
|
||||
'@inquirer/type': 1.2.0
|
||||
dev: true
|
||||
|
||||
/@inquirer/core@7.0.0:
|
||||
resolution: {integrity: sha512-g13W5yEt9r1sEVVriffJqQ8GWy94OnfxLCreNSOTw0HPVcszmc/If1KIf7YBmlwtX4klmvwpZHnQpl3N7VX2xA==}
|
||||
engines: {node: '>=18'}
|
||||
dependencies:
|
||||
'@inquirer/type': 1.2.0
|
||||
'@types/mute-stream': 0.0.4
|
||||
'@types/node': 20.11.25
|
||||
'@types/wrap-ansi': 3.0.0
|
||||
ansi-escapes: 4.3.2
|
||||
chalk: 4.1.2
|
||||
cli-spinners: 2.9.2
|
||||
cli-width: 4.1.0
|
||||
figures: 3.2.0
|
||||
mute-stream: 1.0.0
|
||||
run-async: 3.0.0
|
||||
signal-exit: 4.1.0
|
||||
strip-ansi: 6.0.1
|
||||
wrap-ansi: 6.2.0
|
||||
dev: true
|
||||
|
||||
/@inquirer/type@1.2.0:
|
||||
resolution: {integrity: sha512-/vvkUkYhrjbm+RolU7V1aUFDydZVKNKqKHR5TsE+j5DXgXFwrsOPcoGUJ02K0O7q7O53CU2DOTMYCHeGZ25WHA==}
|
||||
engines: {node: '>=18'}
|
||||
dev: true
|
||||
|
||||
/@isaacs/cliui@8.0.2:
|
||||
resolution: {integrity: sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==}
|
||||
engines: {node: '>=12'}
|
||||
|
@ -2704,28 +2749,21 @@ packages:
|
|||
react-dom: 18.2.0(react@18.2.0)
|
||||
dev: false
|
||||
|
||||
/@mswjs/cookies@0.2.2:
|
||||
resolution: {integrity: sha512-mlN83YSrcFgk7Dm1Mys40DLssI1KdJji2CMKN8eOlBqsTADYzj2+jWzsANsUTFbxDMWPD5e9bfA1RGqBpS3O1g==}
|
||||
engines: {node: '>=14'}
|
||||
dependencies:
|
||||
'@types/set-cookie-parser': 2.4.3
|
||||
set-cookie-parser: 2.6.0
|
||||
/@mswjs/cookies@1.1.0:
|
||||
resolution: {integrity: sha512-0ZcCVQxifZmhwNBoQIrystCb+2sWBY2Zw8lpfJBPCHGCA/HWqehITeCRVIv4VMy8MPlaHo2w2pTHFV2pFfqKPw==}
|
||||
engines: {node: '>=18'}
|
||||
dev: true
|
||||
|
||||
/@mswjs/interceptors@0.17.9:
|
||||
resolution: {integrity: sha512-4LVGt03RobMH/7ZrbHqRxQrS9cc2uh+iNKSj8UWr8M26A2i793ju+csaB5zaqYltqJmA2jUq4VeYfKmVqvsXQg==}
|
||||
engines: {node: '>=14'}
|
||||
/@mswjs/interceptors@0.25.16:
|
||||
resolution: {integrity: sha512-8QC8JyKztvoGAdPgyZy49c9vSHHAZjHagwl4RY9E8carULk8ym3iTaiawrT1YoLF/qb449h48f71XDPgkUSOUg==}
|
||||
engines: {node: '>=18'}
|
||||
dependencies:
|
||||
'@open-draft/until': 1.0.3
|
||||
'@types/debug': 4.1.8
|
||||
'@xmldom/xmldom': 0.8.10
|
||||
debug: 4.3.4
|
||||
headers-polyfill: 3.2.3
|
||||
outvariant: 1.4.0
|
||||
strict-event-emitter: 0.2.8
|
||||
web-encoding: 1.1.5
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
'@open-draft/deferred-promise': 2.2.0
|
||||
'@open-draft/logger': 0.3.0
|
||||
'@open-draft/until': 2.1.0
|
||||
is-node-process: 1.2.0
|
||||
outvariant: 1.4.2
|
||||
strict-event-emitter: 0.5.1
|
||||
dev: true
|
||||
|
||||
/@mui/base@5.0.0-alpha.128(@types/react@18.2.6)(react-dom@18.2.0)(react@18.2.0):
|
||||
|
@ -3004,8 +3042,19 @@ packages:
|
|||
'@octokit/openapi-types': 19.0.2
|
||||
dev: true
|
||||
|
||||
/@open-draft/until@1.0.3:
|
||||
resolution: {integrity: sha512-Aq58f5HiWdyDlFffbbSjAlv596h/cOnt2DO1w3DOC7OJ5EHs0hd/nycJfiu9RJbT6Yk6F1knnRRXNSpxoIVZ9Q==}
|
||||
/@open-draft/deferred-promise@2.2.0:
|
||||
resolution: {integrity: sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==}
|
||||
dev: true
|
||||
|
||||
/@open-draft/logger@0.3.0:
|
||||
resolution: {integrity: sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==}
|
||||
dependencies:
|
||||
is-node-process: 1.2.0
|
||||
outvariant: 1.4.2
|
||||
dev: true
|
||||
|
||||
/@open-draft/until@2.1.0:
|
||||
resolution: {integrity: sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==}
|
||||
dev: true
|
||||
|
||||
/@pkgjs/parseargs@0.11.0:
|
||||
|
@ -4948,8 +4997,8 @@ packages:
|
|||
'@types/node': 18.19.0
|
||||
dev: true
|
||||
|
||||
/@types/cookie@0.4.1:
|
||||
resolution: {integrity: sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==}
|
||||
/@types/cookie@0.6.0:
|
||||
resolution: {integrity: sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==}
|
||||
dev: true
|
||||
|
||||
/@types/cross-spawn@6.0.4:
|
||||
|
@ -4963,12 +5012,6 @@ packages:
|
|||
dependencies:
|
||||
'@types/ms': 0.7.34
|
||||
|
||||
/@types/debug@4.1.8:
|
||||
resolution: {integrity: sha512-/vPO1EPOs306Cvhwv7KfVfYvOJqA/S/AXjaHQiJboCZzcNDb+TIJFN9/2C9DZ//ijSKWioNyUxD792QmDJ+HKQ==}
|
||||
dependencies:
|
||||
'@types/ms': 0.7.34
|
||||
dev: true
|
||||
|
||||
/@types/detect-port@1.3.4:
|
||||
resolution: {integrity: sha512-HveFGabu3IwATqwLelcp6UZ1MIzSFwk+qswC9luzzHufqAwhs22l7KkINDLWRfXxIPTYnSZ1DuQBEgeVPgUOSA==}
|
||||
dev: true
|
||||
|
@ -5083,10 +5126,6 @@ packages:
|
|||
resolution: {integrity: sha512-aLkWa0C0vO5b4Sr798E26QgOkss68Un0bLjs7u9qxzPT5CG+8DuNTffWES58YzJs3hrVAOs1wonycqEBqNJubA==}
|
||||
dev: false
|
||||
|
||||
/@types/js-levenshtein@1.1.1:
|
||||
resolution: {integrity: sha512-qC4bCqYGy1y/NP7dDVr7KJarn+PbX1nSpwA7JXdu0HxT3QYjO8MJ+cntENtHFVy2dRAyBV23OZ6MxsW1AM1L8g==}
|
||||
dev: true
|
||||
|
||||
/@types/jsdom@20.0.1:
|
||||
resolution: {integrity: sha512-d0r18sZPmMQr1eG35u12FZfhIXNrnsPU/g5wvRKCUf/tOGilKKwYMYGqh33BNR6ba+2gkHw1EUiHoN3mn7E5IQ==}
|
||||
dependencies:
|
||||
|
@ -5142,6 +5181,12 @@ packages:
|
|||
/@types/ms@0.7.34:
|
||||
resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==}
|
||||
|
||||
/@types/mute-stream@0.0.4:
|
||||
resolution: {integrity: sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==}
|
||||
dependencies:
|
||||
'@types/node': 18.19.0
|
||||
dev: true
|
||||
|
||||
/@types/node-fetch@2.6.9:
|
||||
resolution: {integrity: sha512-bQVlnMLFJ2d35DkPNjEPmd9ueO/rh5EiaZt2bhqiSarPjZIuIV6bPQVqcrEyvNo+AfTrRGVazle1tl597w3gfA==}
|
||||
dependencies:
|
||||
|
@ -5155,6 +5200,12 @@ packages:
|
|||
undici-types: 5.26.5
|
||||
dev: true
|
||||
|
||||
/@types/node@20.11.25:
|
||||
resolution: {integrity: sha512-TBHyJxk2b7HceLVGFcpAUjsa5zIdsPWlR6XHfyGzd0SFu+/NFgQgMAl96MSDZgQDvJAvV6BKsFOrt6zIL09JDw==}
|
||||
dependencies:
|
||||
undici-types: 5.26.5
|
||||
dev: true
|
||||
|
||||
/@types/normalize-package-data@2.4.3:
|
||||
resolution: {integrity: sha512-ehPtgRgaULsFG8x0NeYJvmyH1hmlfsNLujHe9dQEia/7MAJYdzMSi19JtchUHjmBA6XC/75dK55mzZH+RyieSg==}
|
||||
dev: true
|
||||
|
@ -5270,12 +5321,6 @@ packages:
|
|||
'@types/node': 18.19.0
|
||||
dev: true
|
||||
|
||||
/@types/set-cookie-parser@2.4.3:
|
||||
resolution: {integrity: sha512-7QhnH7bi+6KAhBB+Auejz1uV9DHiopZqu7LfR/5gZZTkejJV5nYeZZpgfFoE0N8aDsXuiYpfKyfyMatCwQhyTQ==}
|
||||
dependencies:
|
||||
'@types/node': 18.19.0
|
||||
dev: true
|
||||
|
||||
/@types/ssh2@1.11.13:
|
||||
resolution: {integrity: sha512-08WbG68HvQ2YVi74n2iSUnYHYpUdFc/s2IsI0BHBdJwaqYJpWlVv9elL0tYShTv60yr0ObdxJR5NrCRiGJ/0CQ==}
|
||||
dependencies:
|
||||
|
@ -5286,6 +5331,10 @@ packages:
|
|||
resolution: {integrity: sha512-Hl219/BT5fLAaz6NDkSuhzasy49dwQS/DSdu4MdggFB8zcXv7vflBI3xp7FEmkmdDkBUI2bPUNeMttp2knYdxw==}
|
||||
dev: true
|
||||
|
||||
/@types/statuses@2.0.4:
|
||||
resolution: {integrity: sha512-eqNDvZsCNY49OAXB0Firg/Sc2BgoWsntsLUdybGFOhAfCD6QJ2n9HXUIHGqt5qjrxmMv4wS8WLAw43ZkKcJ8Pw==}
|
||||
dev: true
|
||||
|
||||
/@types/tough-cookie@4.0.2:
|
||||
resolution: {integrity: sha512-Q5vtl1W5ue16D+nIaW8JWebSSraJVlK+EthKn7e7UcD4KWsaSJ8BqGPXNaPghgtcn/fhvrN17Tv8ksUsQpiplw==}
|
||||
dev: true
|
||||
|
@ -5309,6 +5358,10 @@ packages:
|
|||
resolution: {integrity: sha512-D0HJET2/UY6k9L6y3f5BL+IDxZmPkYmPT4+qBrRdmRLYRuV0qNKizMgTvYxXZYn+36zjPeoDZAEYBCM6XB+gww==}
|
||||
dev: true
|
||||
|
||||
/@types/wrap-ansi@3.0.0:
|
||||
resolution: {integrity: sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==}
|
||||
dev: true
|
||||
|
||||
/@types/yargs-parser@21.0.2:
|
||||
resolution: {integrity: sha512-5qcvofLPbfjmBfKaLfj/+f+Sbd6pN4zl7w7VSVI5uz7m9QZTuB2aZAa2uo1wHFBNN2x6g/SoTkXmd8mQnQF2Cw==}
|
||||
dev: true
|
||||
|
@ -5575,11 +5628,6 @@ packages:
|
|||
pretty-format: 29.7.0
|
||||
dev: true
|
||||
|
||||
/@xmldom/xmldom@0.8.10:
|
||||
resolution: {integrity: sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==}
|
||||
engines: {node: '>=10.0.0'}
|
||||
dev: true
|
||||
|
||||
/@xobotyi/scrollbar-width@1.9.5:
|
||||
resolution: {integrity: sha512-N8tkAACJx2ww8vFMneJmaAgmjAG1tnVBZJRLRcx061tmsLRZHSEZSLuGWnwPtunsSLvSqXQ2wfp7Mgqg1I+2dQ==}
|
||||
dev: false
|
||||
|
@ -5610,12 +5658,6 @@ packages:
|
|||
tslib: 1.14.1
|
||||
dev: true
|
||||
|
||||
/@zxing/text-encoding@0.9.0:
|
||||
resolution: {integrity: sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA==}
|
||||
requiresBuild: true
|
||||
dev: true
|
||||
optional: true
|
||||
|
||||
/abab@2.0.6:
|
||||
resolution: {integrity: sha512-j2afSsaIENvHZN2B8GOpF566vZ5WVk5opAiMTvWgaQT8DkbOqsTfvNAvHoRGU2zzP8cPoqys+xHTRDWW8L+/BA==}
|
||||
dev: true
|
||||
|
@ -6401,10 +6443,6 @@ packages:
|
|||
resolution: {integrity: sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg==}
|
||||
dev: false
|
||||
|
||||
/chardet@0.7.0:
|
||||
resolution: {integrity: sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==}
|
||||
dev: true
|
||||
|
||||
/chart.js@4.4.0:
|
||||
resolution: {integrity: sha512-vQEj6d+z0dcsKLlQvbKIMYFHd3t8W/7L2vfJIbYcfyPcRx92CsHqECpueN8qVGNlKyDcr5wBrYAYKnfu/9Q1hQ==}
|
||||
engines: {pnpm: '>=7'}
|
||||
|
@ -6513,6 +6551,11 @@ packages:
|
|||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/cli-spinners@2.9.2:
|
||||
resolution: {integrity: sha512-ywqV+5MmyL4E7ybXgKys4DugZbX0FC6LnwrhjuykIjnK9k8OQacQ7axGKnjDXWNhns0xot3bZI5h55H8yo9cJg==}
|
||||
engines: {node: '>=6'}
|
||||
dev: true
|
||||
|
||||
/cli-table3@0.6.3:
|
||||
resolution: {integrity: sha512-w5Jac5SykAeZJKntOxJCrm63Eg5/4dhMWIcuTbo9rpE+brgaSZo0RuNJZeOyMgsUdhDeojvgyQLmjI+K50ZGyg==}
|
||||
engines: {node: 10.* || >= 12.*}
|
||||
|
@ -6522,9 +6565,9 @@ packages:
|
|||
'@colors/colors': 1.5.0
|
||||
dev: true
|
||||
|
||||
/cli-width@3.0.0:
|
||||
resolution: {integrity: sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==}
|
||||
engines: {node: '>= 10'}
|
||||
/cli-width@4.1.0:
|
||||
resolution: {integrity: sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==}
|
||||
engines: {node: '>= 12'}
|
||||
dev: true
|
||||
|
||||
/cliui@8.0.1:
|
||||
|
@ -6681,11 +6724,6 @@ packages:
|
|||
resolution: {integrity: sha512-QADzlaHc8icV8I7vbaJXJwod9HWYp8uCqf1xa4OfNu1T7JVxQIrUgOWtHdNDtPiywmFbiS12VjotIXLrKM3orQ==}
|
||||
dev: true
|
||||
|
||||
/cookie@0.4.2:
|
||||
resolution: {integrity: sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==}
|
||||
engines: {node: '>= 0.6'}
|
||||
dev: true
|
||||
|
||||
/cookie@0.5.0:
|
||||
resolution: {integrity: sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
@ -6772,14 +6810,6 @@ packages:
|
|||
hasBin: true
|
||||
dev: false
|
||||
|
||||
/cross-fetch@3.1.8:
|
||||
resolution: {integrity: sha512-cvA+JwZoU0Xq+h6WkMvAUqPEYy92Obet6UdKLfW60qn99ftItKjB5T+BkyWOFWe2pUyfQ+IJHmpOTznqk1M6Kg==}
|
||||
dependencies:
|
||||
node-fetch: 2.7.0
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
dev: true
|
||||
|
||||
/cross-spawn@7.0.3:
|
||||
resolution: {integrity: sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==}
|
||||
engines: {node: '>= 8'}
|
||||
|
@ -7815,11 +7845,6 @@ packages:
|
|||
engines: {node: '>= 0.6'}
|
||||
dev: true
|
||||
|
||||
/events@3.3.0:
|
||||
resolution: {integrity: sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==}
|
||||
engines: {node: '>=0.8.x'}
|
||||
dev: true
|
||||
|
||||
/eventsourcemock@2.0.0:
|
||||
resolution: {integrity: sha512-tSmJnuE+h6A8/hLRg0usf1yL+Q8w01RQtmg0Uzgoxk/HIPZrIUeAr/A4es/8h1wNsoG8RdiESNQLTKiNwbSC3Q==}
|
||||
dev: true
|
||||
|
@ -7898,15 +7923,6 @@ packages:
|
|||
/extend@3.0.2:
|
||||
resolution: {integrity: sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==}
|
||||
|
||||
/external-editor@3.1.0:
|
||||
resolution: {integrity: sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==}
|
||||
engines: {node: '>=4'}
|
||||
dependencies:
|
||||
chardet: 0.7.0
|
||||
iconv-lite: 0.4.24
|
||||
tmp: 0.0.33
|
||||
dev: true
|
||||
|
||||
/extract-zip@1.7.0:
|
||||
resolution: {integrity: sha512-xoh5G1W/PB0/27lXgMQyIhP5DSY/LhoCsOyZgb+6iMmRtCwVBo55uKaMoEYrDCKQhWvqEip5ZPKAc6eFNyf/MA==}
|
||||
hasBin: true
|
||||
|
@ -8412,8 +8428,8 @@ packages:
|
|||
resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==}
|
||||
dev: true
|
||||
|
||||
/graphql@16.7.1:
|
||||
resolution: {integrity: sha512-DRYR9tf+UGU0KOsMcKAlXeFfX89UiiIZ0dRU3mR0yJfu6OjZqUcp68NnFLnqQU5RexygFoDy1EW+ccOYcPfmHg==}
|
||||
/graphql@16.8.1:
|
||||
resolution: {integrity: sha512-59LZHPdGZVh695Ud9lRzPBVTtlX9ZCV150Er2W43ro37wVof0ctenSaskPPjN7lVTIN8mSZt8PHUNKZuNQUuxw==}
|
||||
engines: {node: ^12.22.0 || ^14.16.0 || ^16.0.0 || >=17.0.0}
|
||||
dev: true
|
||||
|
||||
|
@ -8528,8 +8544,8 @@ packages:
|
|||
space-separated-tokens: 1.1.5
|
||||
dev: false
|
||||
|
||||
/headers-polyfill@3.2.3:
|
||||
resolution: {integrity: sha512-oj6MO8sdFQ9gQQedSVdMGh96suxTNp91vPQu7C4qx/57FqYsA5TiNr92nhIZwVQq8zygn4nu3xS1aEqpakGqdw==}
|
||||
/headers-polyfill@4.0.2:
|
||||
resolution: {integrity: sha512-EWGTfnTqAO2L/j5HZgoM/3z82L7necsJ0pO9Tp0X1wil3PDLrkypTBRgVO2ExehEEvUycejZD3FuRaXpZZc3kw==}
|
||||
dev: true
|
||||
|
||||
/highlight.js@10.7.3:
|
||||
|
@ -8695,27 +8711,6 @@ packages:
|
|||
fast-loops: 1.1.3
|
||||
dev: false
|
||||
|
||||
/inquirer@8.2.5:
|
||||
resolution: {integrity: sha512-QAgPDQMEgrDssk1XiwwHoOGYF9BAbUcc1+j+FhEvaOt8/cKRqyLn0U5qA6F74fGhTMGxf92pOvPBeh29jQJDTQ==}
|
||||
engines: {node: '>=12.0.0'}
|
||||
dependencies:
|
||||
ansi-escapes: 4.3.2
|
||||
chalk: 4.1.2
|
||||
cli-cursor: 3.1.0
|
||||
cli-width: 3.0.0
|
||||
external-editor: 3.1.0
|
||||
figures: 3.2.0
|
||||
lodash: 4.17.21
|
||||
mute-stream: 0.0.8
|
||||
ora: 5.4.1
|
||||
run-async: 2.4.1
|
||||
rxjs: 7.8.1
|
||||
string-width: 4.2.3
|
||||
strip-ansi: 6.0.1
|
||||
through: 2.3.8
|
||||
wrap-ansi: 7.0.0
|
||||
dev: true
|
||||
|
||||
/internal-slot@1.0.6:
|
||||
resolution: {integrity: sha512-Xj6dv+PsbtwyPpEflsejS+oIZxmMlV44zAhG479uYu89MsjcYOhCFnNyKrkJrihbsiasQyY0afoCl/9BLR65bg==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
@ -9310,15 +9305,6 @@ packages:
|
|||
jest-util: 29.7.0
|
||||
dev: true
|
||||
|
||||
/jest-fetch-mock@3.0.3:
|
||||
resolution: {integrity: sha512-Ux1nWprtLrdrH4XwE7O7InRY6psIi3GOsqNESJgMJ+M5cv4A8Lh7SN9d2V2kKRZ8ebAfcd1LNyZguAOb6JiDqw==}
|
||||
dependencies:
|
||||
cross-fetch: 3.1.8
|
||||
promise-polyfill: 8.3.0
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
dev: true
|
||||
|
||||
/jest-get-type@29.4.3:
|
||||
resolution: {integrity: sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==}
|
||||
engines: {node: ^14.15.0 || ^16.10.0 || >=18.0.0}
|
||||
|
@ -9676,11 +9662,6 @@ packages:
|
|||
resolution: {integrity: sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ==}
|
||||
dev: false
|
||||
|
||||
/js-levenshtein@1.1.6:
|
||||
resolution: {integrity: sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/js-tokens@4.0.0:
|
||||
resolution: {integrity: sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==}
|
||||
|
||||
|
@ -10997,44 +10978,40 @@ packages:
|
|||
resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==}
|
||||
dev: true
|
||||
|
||||
/msw@1.3.0(typescript@5.2.2):
|
||||
resolution: {integrity: sha512-nnWAZlQyQOKeYRblCpseT1kSPt1aF5e/jHz1hn/18IxbsMFreSVV1cJriT0uV+YG6+wvwFRMHXU3zVuMvuwERQ==}
|
||||
engines: {node: '>=14'}
|
||||
/msw@2.2.3(typescript@5.2.2):
|
||||
resolution: {integrity: sha512-84CoNCkcJ/EvY8Tv0tD/6HKVd4S5HyGowHjM5W12K8Wgryp4fikqS7IaTOceyQgP5dNedxo2icTLDXo7dkpxCg==}
|
||||
engines: {node: '>=18'}
|
||||
hasBin: true
|
||||
requiresBuild: true
|
||||
peerDependencies:
|
||||
typescript: '>= 4.4.x <= 5.2.x'
|
||||
typescript: '>= 4.7.x'
|
||||
peerDependenciesMeta:
|
||||
typescript:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@mswjs/cookies': 0.2.2
|
||||
'@mswjs/interceptors': 0.17.9
|
||||
'@open-draft/until': 1.0.3
|
||||
'@types/cookie': 0.4.1
|
||||
'@types/js-levenshtein': 1.1.1
|
||||
'@bundled-es-modules/cookie': 2.0.0
|
||||
'@bundled-es-modules/statuses': 1.0.1
|
||||
'@inquirer/confirm': 3.0.0
|
||||
'@mswjs/cookies': 1.1.0
|
||||
'@mswjs/interceptors': 0.25.16
|
||||
'@open-draft/until': 2.1.0
|
||||
'@types/cookie': 0.6.0
|
||||
'@types/statuses': 2.0.4
|
||||
chalk: 4.1.2
|
||||
chokidar: 3.5.3
|
||||
cookie: 0.4.2
|
||||
graphql: 16.7.1
|
||||
headers-polyfill: 3.2.3
|
||||
inquirer: 8.2.5
|
||||
graphql: 16.8.1
|
||||
headers-polyfill: 4.0.2
|
||||
is-node-process: 1.2.0
|
||||
js-levenshtein: 1.1.6
|
||||
node-fetch: 2.7.0
|
||||
outvariant: 1.4.0
|
||||
outvariant: 1.4.2
|
||||
path-to-regexp: 6.2.1
|
||||
strict-event-emitter: 0.4.6
|
||||
type-fest: 2.19.0
|
||||
strict-event-emitter: 0.5.1
|
||||
type-fest: 4.11.1
|
||||
typescript: 5.2.2
|
||||
yargs: 17.7.2
|
||||
transitivePeerDependencies:
|
||||
- encoding
|
||||
- supports-color
|
||||
dev: true
|
||||
|
||||
/mute-stream@0.0.8:
|
||||
resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==}
|
||||
/mute-stream@1.0.0:
|
||||
resolution: {integrity: sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==}
|
||||
engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0}
|
||||
dev: true
|
||||
|
||||
/nan@2.17.0:
|
||||
|
@ -11304,13 +11281,8 @@ packages:
|
|||
wcwidth: 1.0.1
|
||||
dev: true
|
||||
|
||||
/os-tmpdir@1.0.2:
|
||||
resolution: {integrity: sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==}
|
||||
engines: {node: '>=0.10.0'}
|
||||
dev: true
|
||||
|
||||
/outvariant@1.4.0:
|
||||
resolution: {integrity: sha512-AlWY719RF02ujitly7Kk/0QlV+pXGFDHrHf9O2OKqyqgBieaPOIeuSkL8sRK6j2WK+/ZAURq2kZsY0d8JapUiw==}
|
||||
/outvariant@1.4.2:
|
||||
resolution: {integrity: sha512-Ou3dJ6bA/UJ5GVHxah4LnqDwZRwAmWxrG3wtrHrbGnP4RnLCtA64A4F+ae7Y8ww660JaddSoArUR5HjipWSHAQ==}
|
||||
dev: true
|
||||
|
||||
/p-limit@2.3.0:
|
||||
|
@ -11621,10 +11593,6 @@ packages:
|
|||
engines: {node: '>=0.4.0'}
|
||||
dev: true
|
||||
|
||||
/promise-polyfill@8.3.0:
|
||||
resolution: {integrity: sha512-H5oELycFml5yto/atYqmjyigJoAo3+OXwolYiH7OfQuYlAqhxNvTfiNMbV9hsC6Yp83yE5r2KTVmtrG6R9i6Pg==}
|
||||
dev: true
|
||||
|
||||
/prompts@2.4.2:
|
||||
resolution: {integrity: sha512-NxNv/kLguCA7p3jE8oL2aEBsrJWgAakBpgmgK6lpPWV+WuOmY6r2/zbAVnP+T8bQlA0nzHXSJSJW0Hq7ylaD2Q==}
|
||||
engines: {node: '>= 6'}
|
||||
|
@ -12489,8 +12457,8 @@ packages:
|
|||
'@babel/runtime': 7.23.2
|
||||
dev: false
|
||||
|
||||
/run-async@2.4.1:
|
||||
resolution: {integrity: sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==}
|
||||
/run-async@3.0.0:
|
||||
resolution: {integrity: sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==}
|
||||
engines: {node: '>=0.12.0'}
|
||||
dev: true
|
||||
|
||||
|
@ -12602,10 +12570,6 @@ packages:
|
|||
/set-blocking@2.0.0:
|
||||
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
|
||||
|
||||
/set-cookie-parser@2.6.0:
|
||||
resolution: {integrity: sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==}
|
||||
dev: true
|
||||
|
||||
/set-function-length@1.1.1:
|
||||
resolution: {integrity: sha512-VoaqjbBJKiWtg4yRcKBQ7g7wnGnLV3M8oLvVWwOk2PdYY6PEFegR1vezXR0tw6fZGF9csVakIRjrJiy2veSBFQ==}
|
||||
engines: {node: '>= 0.4'}
|
||||
|
@ -12895,14 +12859,8 @@ packages:
|
|||
resolution: {integrity: sha512-AiisoFqQ0vbGcZgQPY1cdP2I76glaVA/RauYR4G4thNFgkTqr90yXTo4LYX60Jl+sIlPNHHdGSwo01AvbKUSVQ==}
|
||||
dev: true
|
||||
|
||||
/strict-event-emitter@0.2.8:
|
||||
resolution: {integrity: sha512-KDf/ujU8Zud3YaLtMCcTI4xkZlZVIYxTLr+XIULexP+77EEVWixeXroLUXQXiVtH4XH2W7jr/3PT1v3zBuvc3A==}
|
||||
dependencies:
|
||||
events: 3.3.0
|
||||
dev: true
|
||||
|
||||
/strict-event-emitter@0.4.6:
|
||||
resolution: {integrity: sha512-12KWeb+wixJohmnwNFerbyiBrAlq5qJLwIt38etRtKtmmHyDSoGlIqFE9wx+4IwG0aDjI7GV8tc8ZccjWZZtTg==}
|
||||
/strict-event-emitter@0.5.1:
|
||||
resolution: {integrity: sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==}
|
||||
dev: true
|
||||
|
||||
/string-length@4.0.2:
|
||||
|
@ -13186,10 +13144,6 @@ packages:
|
|||
xtend: 4.0.2
|
||||
dev: true
|
||||
|
||||
/through@2.3.8:
|
||||
resolution: {integrity: sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg==}
|
||||
dev: true
|
||||
|
||||
/tiny-case@1.0.3:
|
||||
resolution: {integrity: sha512-Eet/eeMhkO6TX8mnUteS9zgPbUMQa4I6Kkp5ORiBD5476/m+PIRiumP5tmh5ioJpH7k51Kehawy2UDfsnxxY8Q==}
|
||||
dev: false
|
||||
|
@ -13211,13 +13165,6 @@ packages:
|
|||
engines: {node: '>=14.0.0'}
|
||||
dev: true
|
||||
|
||||
/tmp@0.0.33:
|
||||
resolution: {integrity: sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==}
|
||||
engines: {node: '>=0.6.0'}
|
||||
dependencies:
|
||||
os-tmpdir: 1.0.2
|
||||
dev: true
|
||||
|
||||
/tmpl@1.0.5:
|
||||
resolution: {integrity: sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw==}
|
||||
dev: true
|
||||
|
@ -13453,6 +13400,11 @@ packages:
|
|||
resolution: {integrity: sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==}
|
||||
engines: {node: '>=12.20'}
|
||||
|
||||
/type-fest@4.11.1:
|
||||
resolution: {integrity: sha512-MFMf6VkEVZAETidGGSYW2B1MjXbGX+sWIywn2QPEaJ3j08V+MwVRHMXtf2noB8ENJaD0LIun9wh5Z6OPNf1QzQ==}
|
||||
engines: {node: '>=16'}
|
||||
dev: true
|
||||
|
||||
/type-is@1.6.18:
|
||||
resolution: {integrity: sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==}
|
||||
engines: {node: '>= 0.6'}
|
||||
|
@ -13538,6 +13490,11 @@ packages:
|
|||
resolution: {integrity: sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==}
|
||||
dev: true
|
||||
|
||||
/undici@6.7.1:
|
||||
resolution: {integrity: sha512-+Wtb9bAQw6HYWzCnxrPTMVEV3Q1QjYanI0E4q02ehReMuquQdLTEFEYbfs7hcImVYKcQkWSwT6buEmSVIiDDtQ==}
|
||||
engines: {node: '>=18.0'}
|
||||
dev: false
|
||||
|
||||
/unicode-canonical-property-names-ecmascript@2.0.0:
|
||||
resolution: {integrity: sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==}
|
||||
engines: {node: '>=4'}
|
||||
|
@ -14039,14 +13996,6 @@ packages:
|
|||
defaults: 1.0.4
|
||||
dev: true
|
||||
|
||||
/web-encoding@1.1.5:
|
||||
resolution: {integrity: sha512-HYLeVCdJ0+lBYV2FvNZmv3HJ2Nt0QYXqZojk3d9FJOLkwnuhzM9tmamh8d7HPM8QqjKH8DeHkFTx+CFlWpZZDA==}
|
||||
dependencies:
|
||||
util: 0.12.5
|
||||
optionalDependencies:
|
||||
'@zxing/text-encoding': 0.9.0
|
||||
dev: true
|
||||
|
||||
/webidl-conversions@3.0.1:
|
||||
resolution: {integrity: sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==}
|
||||
|
||||
|
@ -14137,6 +14086,15 @@ packages:
|
|||
resolution: {integrity: sha512-gvVzJFlPycKc5dZN4yPkP8w7Dc37BtP1yczEneOb4uq34pXZcvrtRTmWV8W+Ume+XCxKgbjM+nevkyFPMybd4Q==}
|
||||
dev: true
|
||||
|
||||
/wrap-ansi@6.2.0:
|
||||
resolution: {integrity: sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==}
|
||||
engines: {node: '>=8'}
|
||||
dependencies:
|
||||
ansi-styles: 4.3.0
|
||||
string-width: 4.2.3
|
||||
strip-ansi: 6.0.1
|
||||
dev: true
|
||||
|
||||
/wrap-ansi@7.0.0:
|
||||
resolution: {integrity: sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==}
|
||||
engines: {node: '>=10'}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import "testHelpers/localStorage";
|
||||
import { screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { rest } from "msw";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import type { Region } from "api/typesGenerated";
|
||||
import {
|
||||
MockPrimaryWorkspaceProxy,
|
||||
|
@ -352,22 +352,14 @@ describe("ProxyContextSelection", () => {
|
|||
|
||||
// Mock the API response
|
||||
server.use(
|
||||
rest.get("/api/v2/regions", async (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
regions: regions,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
rest.get("/api/v2/workspaceproxies", async (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
regions: regions,
|
||||
}),
|
||||
);
|
||||
}),
|
||||
http.get("/api/v2/regions", () =>
|
||||
HttpResponse.json({
|
||||
regions,
|
||||
}),
|
||||
),
|
||||
http.get("/api/v2/workspaceproxies", () =>
|
||||
HttpResponse.json({ regions }),
|
||||
),
|
||||
);
|
||||
|
||||
TestingComponent();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { renderHook, screen } from "@testing-library/react";
|
||||
import { rest } from "msw";
|
||||
import { screen, renderHook } from "@testing-library/react";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import type { FC, PropsWithChildren } from "react";
|
||||
import { QueryClientProvider } from "react-query";
|
||||
import { MockPermissions, MockUser } from "testHelpers/entities";
|
||||
import {
|
||||
createTestQueryClient,
|
||||
renderWithAuth,
|
||||
createTestQueryClient,
|
||||
} from "testHelpers/renderHelpers";
|
||||
import { server } from "testHelpers/server";
|
||||
import { AuthContext, type AuthContextValue } from "./AuthProvider";
|
||||
|
@ -15,8 +15,8 @@ describe("RequireAuth", () => {
|
|||
it("redirects to /login if user is not authenticated", async () => {
|
||||
// appear logged out
|
||||
server.use(
|
||||
rest.get("/api/v2/users/me", (req, res, ctx) => {
|
||||
return res(ctx.status(401), ctx.json({ message: "no user here" }));
|
||||
http.get("/api/v2/users/me", () => {
|
||||
return HttpResponse.json({ message: "no user here" }, { status: 401 });
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ function render<
|
|||
* There are a lot of test cases in this file. Scoping mocking to inner describe
|
||||
* function calls to limit the cognitive load of maintaining all this stuff
|
||||
*/
|
||||
describe(usePaginatedQuery.name, () => {
|
||||
describe.skip(usePaginatedQuery.name, () => {
|
||||
describe("queryPayload method", () => {
|
||||
const mockQueryFn = jest.fn(() => Promise.resolve({ count: 0 }));
|
||||
|
||||
|
|
|
@ -1,20 +1,17 @@
|
|||
import { screen } from "@testing-library/react";
|
||||
import { rest } from "msw";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import { renderWithAuth } from "testHelpers/renderHelpers";
|
||||
import { server } from "testHelpers/server";
|
||||
import { DashboardLayout } from "./DashboardLayout";
|
||||
|
||||
test("Show the new Coder version notification", async () => {
|
||||
server.use(
|
||||
rest.get("/api/v2/updatecheck", (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
current: false,
|
||||
version: "v0.12.9",
|
||||
url: "https://github.com/coder/coder/releases/tag/v0.12.9",
|
||||
}),
|
||||
);
|
||||
http.get("/api/v2/updatecheck", () => {
|
||||
return HttpResponse.json({
|
||||
current: false,
|
||||
version: "v0.12.9",
|
||||
url: "https://github.com/coder/coder/releases/tag/v0.12.9",
|
||||
});
|
||||
}),
|
||||
);
|
||||
renderWithAuth(<DashboardLayout />, {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { render, screen, waitFor } from "@testing-library/react";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import { App } from "App";
|
||||
import {
|
||||
MockEntitlementsWithAuditLog,
|
||||
|
@ -16,8 +16,8 @@ describe("Navbar", () => {
|
|||
it("shows Audit Log link when permitted and entitled", async () => {
|
||||
// set entitlements to allow audit log
|
||||
server.use(
|
||||
rest.get("/api/v2/entitlements", (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(MockEntitlementsWithAuditLog));
|
||||
http.get("/api/v2/entitlements", () => {
|
||||
return HttpResponse.json(MockEntitlementsWithAuditLog);
|
||||
}),
|
||||
);
|
||||
render(<App />);
|
||||
|
@ -46,14 +46,14 @@ describe("Navbar", () => {
|
|||
it("does not show Audit Log link when not permitted via role", async () => {
|
||||
// set permissions to Member (can't audit)
|
||||
server.use(
|
||||
rest.post("/api/v2/authcheck", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(MockMemberPermissions));
|
||||
http.post("/api/v2/authcheck", async () => {
|
||||
return HttpResponse.json(MockMemberPermissions);
|
||||
}),
|
||||
);
|
||||
// set entitlements to allow audit log
|
||||
server.use(
|
||||
rest.get("/api/v2/entitlements", (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(MockEntitlementsWithAuditLog));
|
||||
http.get("/api/v2/entitlements", () => {
|
||||
return HttpResponse.json(MockEntitlementsWithAuditLog);
|
||||
}),
|
||||
);
|
||||
render(<App />);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { act, renderHook, waitFor } from "@testing-library/react";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import type { FC, PropsWithChildren } from "react";
|
||||
import { QueryClient, QueryClientProvider } from "react-query";
|
||||
import { MockUpdateCheck } from "testHelpers/entities";
|
||||
|
@ -26,14 +26,11 @@ it("is dismissed when does not have permission to see it", () => {
|
|||
|
||||
it("is dismissed when it is already using current version", async () => {
|
||||
server.use(
|
||||
rest.get("/api/v2/updatecheck", (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
...MockUpdateCheck,
|
||||
current: true,
|
||||
}),
|
||||
);
|
||||
http.get("/api/v2/updatecheck", () => {
|
||||
return HttpResponse.json({
|
||||
...MockUpdateCheck,
|
||||
current: true,
|
||||
});
|
||||
}),
|
||||
);
|
||||
const { result } = renderHook(() => useUpdateCheck(true), {
|
||||
|
@ -47,14 +44,11 @@ it("is dismissed when it is already using current version", async () => {
|
|||
|
||||
it("is dismissed when it was dismissed previously", async () => {
|
||||
server.use(
|
||||
rest.get("/api/v2/updatecheck", (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
...MockUpdateCheck,
|
||||
current: false,
|
||||
}),
|
||||
);
|
||||
http.get("/api/v2/updatecheck", () => {
|
||||
return HttpResponse.json({
|
||||
...MockUpdateCheck,
|
||||
current: false,
|
||||
});
|
||||
}),
|
||||
);
|
||||
localStorage.setItem("dismissedVersion", MockUpdateCheck.version);
|
||||
|
@ -69,14 +63,11 @@ it("is dismissed when it was dismissed previously", async () => {
|
|||
|
||||
it("shows when has permission and is outdated", async () => {
|
||||
server.use(
|
||||
rest.get("/api/v2/updatecheck", (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
...MockUpdateCheck,
|
||||
current: false,
|
||||
}),
|
||||
);
|
||||
http.get("/api/v2/updatecheck", () => {
|
||||
return HttpResponse.json({
|
||||
...MockUpdateCheck,
|
||||
current: false,
|
||||
});
|
||||
}),
|
||||
);
|
||||
const { result } = renderHook(() => useUpdateCheck(true), {
|
||||
|
@ -90,14 +81,11 @@ it("shows when has permission and is outdated", async () => {
|
|||
|
||||
it("shows when has permission and is outdated", async () => {
|
||||
server.use(
|
||||
rest.get("/api/v2/updatecheck", (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
...MockUpdateCheck,
|
||||
current: false,
|
||||
}),
|
||||
);
|
||||
http.get("/api/v2/updatecheck", () => {
|
||||
return HttpResponse.json({
|
||||
...MockUpdateCheck,
|
||||
current: false,
|
||||
});
|
||||
}),
|
||||
);
|
||||
const { result } = renderHook(() => useUpdateCheck(true), {
|
||||
|
|
|
@ -3,10 +3,8 @@ import Skeleton from "@mui/material/Skeleton";
|
|||
import Tooltip from "@mui/material/Tooltip";
|
||||
import dayjs from "dayjs";
|
||||
import {
|
||||
createContext,
|
||||
type FC,
|
||||
type HTMLAttributes,
|
||||
useContext,
|
||||
useEffect,
|
||||
useLayoutEffect,
|
||||
useRef,
|
||||
|
@ -22,8 +20,6 @@ import { MONOSPACE_FONT_FAMILY } from "theme/constants";
|
|||
|
||||
type ItemStatus = "stale" | "valid" | "loading";
|
||||
|
||||
export const WatchAgentMetadataContext = createContext(watchAgentMetadata);
|
||||
|
||||
export interface AgentMetadataViewProps {
|
||||
metadata: WorkspaceAgentMetadata[];
|
||||
}
|
||||
|
@ -53,7 +49,6 @@ export const AgentMetadata: FC<AgentMetadataProps> = ({
|
|||
const [metadata, setMetadata] = useState<
|
||||
WorkspaceAgentMetadata[] | undefined
|
||||
>(undefined);
|
||||
const watchAgentMetadata = useContext(WatchAgentMetadataContext);
|
||||
|
||||
useEffect(() => {
|
||||
if (storybookMetadata !== undefined) {
|
||||
|
@ -88,7 +83,7 @@ export const AgentMetadata: FC<AgentMetadataProps> = ({
|
|||
};
|
||||
};
|
||||
return connect();
|
||||
}, [agent.id, watchAgentMetadata, storybookMetadata]);
|
||||
}, [agent.id, storybookMetadata]);
|
||||
|
||||
if (metadata === undefined) {
|
||||
return (
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
import { screen } from "@testing-library/react";
|
||||
import { QueryClientProvider, QueryClient } from "react-query";
|
||||
import { QueryClientProvider } from "react-query";
|
||||
import {
|
||||
MockListeningPortsResponse,
|
||||
MockTemplate,
|
||||
MockWorkspace,
|
||||
MockWorkspaceAgent,
|
||||
} from "testHelpers/entities";
|
||||
import { renderComponent } from "testHelpers/renderHelpers";
|
||||
import {
|
||||
renderComponent,
|
||||
createTestQueryClient,
|
||||
} from "testHelpers/renderHelpers";
|
||||
import { PortForwardPopoverView } from "./PortForwardButton";
|
||||
|
||||
describe("Port Forward Popover View", () => {
|
||||
it("renders component", async () => {
|
||||
renderComponent(
|
||||
<QueryClientProvider client={new QueryClient()}>
|
||||
<QueryClientProvider client={createTestQueryClient()}>
|
||||
<PortForwardPopoverView
|
||||
agent={MockWorkspaceAgent}
|
||||
template={MockTemplate}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { screen, waitFor } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import * as API from "api/api";
|
||||
import { DEFAULT_RECORDS_PER_PAGE } from "components/PaginationWidget/utils";
|
||||
import {
|
||||
|
@ -52,8 +52,8 @@ describe("AuditPage", () => {
|
|||
|
||||
// Mock the entitlements
|
||||
server.use(
|
||||
rest.get("/api/v2/entitlements", (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(MockEntitlementsWithAuditLog));
|
||||
http.get("/api/v2/entitlements", () => {
|
||||
return HttpResponse.json(MockEntitlementsWithAuditLog);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { fireEvent, screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import { createMemoryRouter } from "react-router-dom";
|
||||
import {
|
||||
render,
|
||||
|
@ -15,8 +15,8 @@ describe("LoginPage", () => {
|
|||
beforeEach(() => {
|
||||
server.use(
|
||||
// Appear logged out
|
||||
rest.get("/api/v2/users/me", (req, res, ctx) => {
|
||||
return res(ctx.status(401), ctx.json({ message: "no user here" }));
|
||||
http.get("/api/v2/users/me", () => {
|
||||
return HttpResponse.json({ message: "no user here" }, { status: 401 });
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
@ -26,8 +26,8 @@ describe("LoginPage", () => {
|
|||
const apiErrorMessage = "Something wrong happened";
|
||||
server.use(
|
||||
// Make login fail
|
||||
rest.post("/api/v2/users/login", async (req, res, ctx) => {
|
||||
return res(ctx.status(500), ctx.json({ message: apiErrorMessage }));
|
||||
http.post("/api/v2/users/login", async () => {
|
||||
return HttpResponse.json({ message: apiErrorMessage }, { status: 500 });
|
||||
}),
|
||||
);
|
||||
|
||||
|
@ -51,8 +51,8 @@ describe("LoginPage", () => {
|
|||
// Given
|
||||
server.use(
|
||||
// No first user
|
||||
rest.get("/api/v2/users/first", (req, res, ctx) => {
|
||||
return res(ctx.status(404));
|
||||
http.get("/api/v2/users/first", () => {
|
||||
return new HttpResponse(null, { status: 404 });
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
import { screen, waitFor } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import { createMemoryRouter } from "react-router-dom";
|
||||
import type { Response, User } from "api/typesGenerated";
|
||||
import { MockUser } from "testHelpers/entities";
|
||||
import {
|
||||
renderWithRouter,
|
||||
|
@ -36,13 +37,13 @@ describe("Setup Page", () => {
|
|||
beforeEach(() => {
|
||||
// appear logged out
|
||||
server.use(
|
||||
rest.get("/api/v2/users/me", (req, res, ctx) => {
|
||||
return res(ctx.status(401), ctx.json({ message: "no user here" }));
|
||||
http.get("/api/v2/users/me", () => {
|
||||
return HttpResponse.json({ message: "no user here" }, { status: 401 });
|
||||
}),
|
||||
rest.get("/api/v2/users/first", (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(404),
|
||||
ctx.json({ message: "no first user has been created" }),
|
||||
http.get("/api/v2/users/first", () => {
|
||||
return HttpResponse.json(
|
||||
{ message: "no first user has been created" },
|
||||
{ status: 404 },
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
@ -52,30 +53,30 @@ describe("Setup Page", () => {
|
|||
let userHasBeenCreated = false;
|
||||
|
||||
server.use(
|
||||
rest.get("/api/v2/users/me", (req, res, ctx) => {
|
||||
http.get<never, null, User | Response>("/api/v2/users/me", async () => {
|
||||
if (!userHasBeenCreated) {
|
||||
return res(ctx.status(401), ctx.json({ message: "no user here" }));
|
||||
}
|
||||
return res(ctx.status(200), ctx.json(MockUser));
|
||||
}),
|
||||
rest.get("/api/v2/users/first", (req, res, ctx) => {
|
||||
if (!userHasBeenCreated) {
|
||||
return res(
|
||||
ctx.status(404),
|
||||
ctx.json({ message: "no first user has been created" }),
|
||||
return HttpResponse.json(
|
||||
{ message: "no user here" },
|
||||
{ status: 401 },
|
||||
);
|
||||
}
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({ message: "hooray, someone exists!" }),
|
||||
);
|
||||
return HttpResponse.json(MockUser);
|
||||
}),
|
||||
rest.post("/api/v2/users/first", (req, res, ctx) => {
|
||||
http.get<never, null, User | Response>(
|
||||
"/api/v2/users/first",
|
||||
async () => {
|
||||
if (!userHasBeenCreated) {
|
||||
return HttpResponse.json(
|
||||
{ message: "no first user has been created" },
|
||||
{ status: 404 },
|
||||
);
|
||||
}
|
||||
return HttpResponse.json({ message: "hooray, someone exists!" });
|
||||
},
|
||||
),
|
||||
http.post("/api/v2/users/first", () => {
|
||||
userHasBeenCreated = true;
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({ data: "user setup was successful!" }),
|
||||
);
|
||||
return HttpResponse.json({ data: "user setup was successful!" });
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { render, screen } from "@testing-library/react";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import { RouterProvider, createMemoryRouter } from "react-router-dom";
|
||||
import { AppProviders } from "App";
|
||||
import { RequireAuth } from "contexts/auth/RequireAuth";
|
||||
|
@ -12,24 +12,18 @@ import StarterTemplatesPage from "./StarterTemplatesPage";
|
|||
|
||||
test("does not display the scratch template", async () => {
|
||||
server.use(
|
||||
rest.get(
|
||||
"api/v2/organizations/:organizationId/templates/examples",
|
||||
(req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json([
|
||||
MockTemplateExample,
|
||||
MockTemplateExample2,
|
||||
{
|
||||
...MockTemplateExample,
|
||||
id: "scratch",
|
||||
name: "Scratch",
|
||||
description: "Create a template from scratch",
|
||||
},
|
||||
]),
|
||||
);
|
||||
},
|
||||
),
|
||||
http.get("api/v2/organizations/:organizationId/templates/examples", () => {
|
||||
return HttpResponse.json([
|
||||
MockTemplateExample,
|
||||
MockTemplateExample2,
|
||||
{
|
||||
...MockTemplateExample,
|
||||
id: "scratch",
|
||||
name: "Scratch",
|
||||
description: "Create a template from scratch",
|
||||
},
|
||||
]);
|
||||
}),
|
||||
);
|
||||
|
||||
render(
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { render, screen } from "@testing-library/react";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import { RouterProvider, createMemoryRouter } from "react-router-dom";
|
||||
import { AppProviders } from "App";
|
||||
import { RequireAuth } from "contexts/auth/RequireAuth";
|
||||
|
@ -16,10 +16,10 @@ jest.mock("components/SyntaxHighlighter/SyntaxHighlighter", () => ({
|
|||
|
||||
test("displays the template files even when there is no previous version", async () => {
|
||||
server.use(
|
||||
rest.get(
|
||||
http.get(
|
||||
"/api/v2/organizations/:organizationId/templates/:template/versions/:version/previous",
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.status(404));
|
||||
() => {
|
||||
new HttpResponse(null, { status: 404 });
|
||||
},
|
||||
),
|
||||
);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { render, screen, waitFor, within } from "@testing-library/react";
|
||||
import userEvent, { type UserEvent } from "@testing-library/user-event";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import { QueryClient } from "react-query";
|
||||
import { RouterProvider, createMemoryRouter } from "react-router-dom";
|
||||
import * as api from "api/api";
|
||||
|
@ -275,22 +275,19 @@ describe.each([
|
|||
);
|
||||
|
||||
server.use(
|
||||
rest.get(
|
||||
http.get(
|
||||
"/api/v2/organizations/:org/templates/:template/versions/:version",
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.json(templateVersion));
|
||||
() => {
|
||||
return HttpResponse.json(templateVersion);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
||||
if (loadedVariables) {
|
||||
server.use(
|
||||
rest.get(
|
||||
"/api/v2/templateversions/:version/variables",
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.json(loadedVariables));
|
||||
},
|
||||
),
|
||||
http.get("/api/v2/templateversions/:version/variables", () => {
|
||||
return HttpResponse.json(loadedVariables);
|
||||
}),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import "jest-canvas-mock";
|
||||
import { waitFor } from "@testing-library/react";
|
||||
import WS from "jest-websocket-mock";
|
||||
import { rest } from "msw";
|
||||
import { TextDecoder, TextEncoder } from "util";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import * as API from "api/api";
|
||||
import {
|
||||
MockUser,
|
||||
|
@ -30,10 +29,6 @@ Object.defineProperty(window, "matchMedia", {
|
|||
})),
|
||||
});
|
||||
|
||||
Object.defineProperty(window, "TextEncoder", {
|
||||
value: TextEncoder,
|
||||
});
|
||||
|
||||
const renderTerminal = async (
|
||||
route = `/${MockUser.username}/${MockWorkspace.name}/terminal`,
|
||||
) => {
|
||||
|
@ -87,12 +82,9 @@ describe("TerminalPage", () => {
|
|||
it("shows an error if fetching workspace fails", async () => {
|
||||
// Given
|
||||
server.use(
|
||||
rest.get(
|
||||
"/api/v2/users/:userId/workspace/:workspaceName",
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.status(500), ctx.json({ id: "workspace-id" }));
|
||||
},
|
||||
),
|
||||
http.get("/api/v2/users/:userId/workspace/:workspaceName", () => {
|
||||
return HttpResponse.json({ id: "workspace-id" }, { status: 500 });
|
||||
}),
|
||||
);
|
||||
|
||||
// When
|
||||
|
@ -105,8 +97,8 @@ describe("TerminalPage", () => {
|
|||
it("shows an error if the websocket fails", async () => {
|
||||
// Given
|
||||
server.use(
|
||||
rest.get("/api/v2/workspaceagents/:agentId/pty", (req, res, ctx) => {
|
||||
return res(ctx.status(500), ctx.json({}));
|
||||
http.get("/api/v2/workspaceagents/:agentId/pty", () => {
|
||||
return HttpResponse.json({}, { status: 500 });
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { fireEvent, screen, waitFor, within } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import type { UpdateUserQuietHoursScheduleRequest } from "api/typesGenerated";
|
||||
import { MockUser } from "testHelpers/entities";
|
||||
import { renderWithAuth } from "testHelpers/renderHelpers";
|
||||
import { server } from "testHelpers/server";
|
||||
|
@ -54,8 +55,8 @@ const cronTests = [
|
|||
describe("SchedulePage", () => {
|
||||
beforeEach(() => {
|
||||
server.use(
|
||||
rest.get(`/api/v2/users/${MockUser.id}/quiet-hours`, (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(defaultQuietHoursResponse));
|
||||
http.get(`/api/v2/users/${MockUser.id}/quiet-hours`, () => {
|
||||
return HttpResponse.json(defaultQuietHoursResponse);
|
||||
}),
|
||||
);
|
||||
});
|
||||
|
@ -65,22 +66,20 @@ describe("SchedulePage", () => {
|
|||
"case %# has the correct expected time",
|
||||
async (test) => {
|
||||
server.use(
|
||||
rest.put(
|
||||
http.put(
|
||||
`/api/v2/users/${MockUser.id}/quiet-hours`,
|
||||
async (req, res, ctx) => {
|
||||
const data = await req.json();
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
raw_schedule: data.schedule,
|
||||
user_set: true,
|
||||
time: `${test.hour.toString().padStart(2, "0")}:${test.minute
|
||||
.toString()
|
||||
.padStart(2, "0")}`,
|
||||
timezone: test.timezone,
|
||||
next: "", // This value isn't used in the UI, the UI generates it.
|
||||
}),
|
||||
);
|
||||
async ({ request }) => {
|
||||
const data =
|
||||
(await request.json()) as UpdateUserQuietHoursScheduleRequest;
|
||||
return HttpResponse.json({
|
||||
raw_schedule: data.schedule,
|
||||
user_set: true,
|
||||
time: `${test.hour.toString().padStart(2, "0")}:${test.minute
|
||||
.toString()
|
||||
.padStart(2, "0")}`,
|
||||
timezone: test.timezone,
|
||||
next: "", // This value isn't used in the UI, the UI generates it.
|
||||
});
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -99,17 +98,14 @@ describe("SchedulePage", () => {
|
|||
describe("when it is an unknown error", () => {
|
||||
it("shows a generic error message", async () => {
|
||||
server.use(
|
||||
rest.put(
|
||||
`/api/v2/users/${MockUser.id}/quiet-hours`,
|
||||
(req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(500),
|
||||
ctx.json({
|
||||
message: "oh no!",
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
http.put(`/api/v2/users/${MockUser.id}/quiet-hours`, () => {
|
||||
return HttpResponse.json(
|
||||
{
|
||||
message: "oh no!",
|
||||
},
|
||||
{ status: 500 },
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
renderWithAuth(<SchedulePage />);
|
||||
|
@ -124,22 +120,16 @@ describe("SchedulePage", () => {
|
|||
describe("when user custom schedule is disabled", () => {
|
||||
it("shows a warning and disables the form", async () => {
|
||||
server.use(
|
||||
rest.get(
|
||||
`/api/v2/users/${MockUser.id}/quiet-hours`,
|
||||
(req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
raw_schedule: "CRON_TZ=America/Chicago 0 0 * * *",
|
||||
user_can_set: false,
|
||||
user_set: false,
|
||||
time: "00:00",
|
||||
timezone: "America/Chicago",
|
||||
next: "", // not consumed by the frontend
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
http.get(`/api/v2/users/${MockUser.id}/quiet-hours`, () => {
|
||||
return HttpResponse.json({
|
||||
raw_schedule: "CRON_TZ=America/Chicago 0 0 * * *",
|
||||
user_can_set: false,
|
||||
user_set: false,
|
||||
time: "00:00",
|
||||
timezone: "America/Chicago",
|
||||
next: "", // not consumed by the frontend
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
renderWithAuth(<SchedulePage />);
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { fireEvent, screen, within } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import * as API from "api/api";
|
||||
import type { Role } from "api/typesGenerated";
|
||||
import {
|
||||
|
@ -133,12 +133,9 @@ describe("UsersPage", () => {
|
|||
renderPage();
|
||||
|
||||
server.use(
|
||||
rest.put(
|
||||
`/api/v2/users/${MockUser.id}/status/suspend`,
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(SuspendedMockUser));
|
||||
},
|
||||
),
|
||||
http.put(`/api/v2/users/${MockUser.id}/status/suspend`, async () => {
|
||||
return HttpResponse.json(SuspendedMockUser);
|
||||
}),
|
||||
);
|
||||
|
||||
await suspendUser();
|
||||
|
@ -153,17 +150,14 @@ describe("UsersPage", () => {
|
|||
renderPage();
|
||||
|
||||
server.use(
|
||||
rest.put(
|
||||
`/api/v2/users/${MockUser.id}/status/suspend`,
|
||||
async (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(400),
|
||||
ctx.json({
|
||||
message: "Error suspending user.",
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
http.put(`/api/v2/users/${MockUser.id}/status/suspend`, async () => {
|
||||
return HttpResponse.json(
|
||||
{
|
||||
message: "Error suspending user.",
|
||||
},
|
||||
{ status: 400 },
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
await suspendUser();
|
||||
|
@ -180,12 +174,9 @@ describe("UsersPage", () => {
|
|||
renderPage();
|
||||
|
||||
server.use(
|
||||
rest.delete(
|
||||
`/api/v2/users/${MockUser2.id}`,
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(MockUser2));
|
||||
},
|
||||
),
|
||||
http.delete(`/api/v2/users/${MockUser2.id}`, async () => {
|
||||
return HttpResponse.json(MockUser2);
|
||||
}),
|
||||
);
|
||||
|
||||
await deleteUser();
|
||||
|
@ -199,17 +190,14 @@ describe("UsersPage", () => {
|
|||
renderPage();
|
||||
|
||||
server.use(
|
||||
rest.delete(
|
||||
`/api/v2/users/${MockUser2.id}`,
|
||||
async (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(400),
|
||||
ctx.json({
|
||||
message: "Error deleting user.",
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
http.delete(`/api/v2/users/${MockUser2.id}`, async () => {
|
||||
return HttpResponse.json(
|
||||
{
|
||||
message: "Error deleting user.",
|
||||
},
|
||||
{ status: 400 },
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
||||
await deleteUser();
|
||||
|
@ -226,10 +214,10 @@ describe("UsersPage", () => {
|
|||
renderPage();
|
||||
|
||||
server.use(
|
||||
rest.put(
|
||||
http.put(
|
||||
`/api/v2/users/${SuspendedMockUser.id}/status/activate`,
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(MockUser));
|
||||
async () => {
|
||||
return HttpResponse.json(MockUser);
|
||||
},
|
||||
),
|
||||
);
|
||||
|
@ -245,14 +233,14 @@ describe("UsersPage", () => {
|
|||
renderPage();
|
||||
|
||||
server.use(
|
||||
rest.put(
|
||||
http.put(
|
||||
`/api/v2/users/${SuspendedMockUser.id}/status/activate`,
|
||||
async (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(400),
|
||||
ctx.json({
|
||||
async () => {
|
||||
return HttpResponse.json(
|
||||
{
|
||||
message: "Error activating user.",
|
||||
}),
|
||||
},
|
||||
{ status: 400 },
|
||||
);
|
||||
},
|
||||
),
|
||||
|
@ -315,18 +303,12 @@ describe("UsersPage", () => {
|
|||
renderPage();
|
||||
|
||||
server.use(
|
||||
rest.put(
|
||||
`/api/v2/users/${MockUser.id}/roles`,
|
||||
async (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
...MockUser,
|
||||
roles: [...MockUser.roles, MockAuditorRole],
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
http.put(`/api/v2/users/${MockUser.id}/roles`, async () => {
|
||||
return HttpResponse.json({
|
||||
...MockUser,
|
||||
roles: [...MockUser.roles, MockAuditorRole],
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
await updateUserRole(MockAuditorRole);
|
||||
|
@ -340,10 +322,10 @@ describe("UsersPage", () => {
|
|||
renderPage();
|
||||
|
||||
server.use(
|
||||
rest.put(`/api/v2/users/${MockUser.id}/roles`, (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(400),
|
||||
ctx.json({ message: "Error on updating the user roles." }),
|
||||
http.put(`/api/v2/users/${MockUser.id}/roles`, () => {
|
||||
return HttpResponse.json(
|
||||
{ message: "Error on updating the user roles." },
|
||||
{ status: 400 },
|
||||
);
|
||||
}),
|
||||
);
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
import { action } from "@storybook/addon-actions";
|
||||
import type { Meta, StoryObj } from "@storybook/react";
|
||||
import { withReactContext } from "storybook-react-context";
|
||||
import type { ProvisionerJobLog } from "api/typesGenerated";
|
||||
import { ProxyContext, getPreferredProxy } from "contexts/ProxyContext";
|
||||
import EventSource from "eventsourcemock";
|
||||
import { DashboardContext } from "modules/dashboard/DashboardProvider";
|
||||
import { WatchAgentMetadataContext } from "modules/resources/AgentMetadata";
|
||||
import * as Mocks from "testHelpers/entities";
|
||||
import type { WorkspacePermissions } from "./permissions";
|
||||
import { Workspace } from "./Workspace";
|
||||
|
@ -68,12 +65,6 @@ const meta: Meta<typeof Workspace> = {
|
|||
</ProxyContext.Provider>
|
||||
</DashboardContext.Provider>
|
||||
),
|
||||
withReactContext({
|
||||
Context: WatchAgentMetadataContext,
|
||||
initialState: (_: string): EventSource => {
|
||||
return new EventSource();
|
||||
},
|
||||
}),
|
||||
],
|
||||
};
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { screen, waitFor, within } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import * as api from "api/api";
|
||||
import type { TemplateVersionParameter, Workspace } from "api/typesGenerated";
|
||||
import EventSourceMock from "eventsourcemock";
|
||||
|
@ -117,15 +117,12 @@ describe("WorkspacePage", () => {
|
|||
|
||||
// set permissions
|
||||
server.use(
|
||||
rest.post("/api/v2/authcheck", async (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
updateTemplates: true,
|
||||
updateWorkspace: true,
|
||||
updateTemplate: true,
|
||||
}),
|
||||
);
|
||||
http.post("/api/v2/authcheck", async () => {
|
||||
return HttpResponse.json({
|
||||
updateTemplates: true,
|
||||
updateWorkspace: true,
|
||||
updateTemplate: true,
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
||||
|
@ -170,12 +167,9 @@ describe("WorkspacePage", () => {
|
|||
|
||||
it("requests a start job when the user presses Start", async () => {
|
||||
server.use(
|
||||
rest.get(
|
||||
`/api/v2/users/:userId/workspace/:workspaceName`,
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(MockStoppedWorkspace));
|
||||
},
|
||||
),
|
||||
http.get(`/api/v2/users/:userId/workspace/:workspaceName`, () => {
|
||||
return HttpResponse.json(MockStoppedWorkspace);
|
||||
}),
|
||||
);
|
||||
|
||||
const startWorkspaceMock = jest
|
||||
|
@ -215,12 +209,9 @@ describe("WorkspacePage", () => {
|
|||
|
||||
it("requests cancellation when the user presses Cancel", async () => {
|
||||
server.use(
|
||||
rest.get(
|
||||
`/api/v2/users/:userId/workspace/:workspaceName`,
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(MockStartingWorkspace));
|
||||
},
|
||||
),
|
||||
http.get(`/api/v2/users/:userId/workspace/:workspaceName`, () => {
|
||||
return HttpResponse.json(MockStartingWorkspace);
|
||||
}),
|
||||
);
|
||||
|
||||
const cancelWorkspaceMock = jest
|
||||
|
@ -455,12 +446,9 @@ describe("WorkspacePage", () => {
|
|||
} satisfies TemplateVersionParameter;
|
||||
|
||||
server.use(
|
||||
rest.get(
|
||||
"/api/v2/templateversions/:versionId/rich-parameters",
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json([parameter]));
|
||||
},
|
||||
),
|
||||
http.get("/api/v2/templateversions/:versionId/rich-parameters", () => {
|
||||
return HttpResponse.json([parameter]);
|
||||
}),
|
||||
);
|
||||
const startWorkspaceSpy = jest.spyOn(api, "startWorkspace");
|
||||
|
||||
|
@ -504,12 +492,9 @@ describe("WorkspacePage", () => {
|
|||
} satisfies TemplateVersionParameter;
|
||||
|
||||
server.use(
|
||||
rest.get(
|
||||
"/api/v2/templateversions/:versionId/rich-parameters",
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json([parameter]));
|
||||
},
|
||||
),
|
||||
http.get("/api/v2/templateversions/:versionId/rich-parameters", () => {
|
||||
return HttpResponse.json([parameter]);
|
||||
}),
|
||||
);
|
||||
const startWorkspaceSpy = jest.spyOn(api, "startWorkspace");
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { render, screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import dayjs from "dayjs";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import type { FC } from "react";
|
||||
import { QueryClient, QueryClientProvider, useQuery } from "react-query";
|
||||
import { RouterProvider, createMemoryRouter } from "react-router-dom";
|
||||
|
@ -35,21 +35,15 @@ const BASE_DEADLINE = dayjs().add(3, "hour");
|
|||
|
||||
const renderScheduleControls = async () => {
|
||||
server.use(
|
||||
rest.get(
|
||||
"/api/v2/users/:username/workspace/:workspaceName",
|
||||
(req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
...MockWorkspace,
|
||||
latest_build: {
|
||||
...MockWorkspace.latest_build,
|
||||
deadline: BASE_DEADLINE.toISOString(),
|
||||
},
|
||||
}),
|
||||
);
|
||||
},
|
||||
),
|
||||
http.get("/api/v2/users/:username/workspace/:workspaceName", () => {
|
||||
return HttpResponse.json({
|
||||
...MockWorkspace,
|
||||
latest_build: {
|
||||
...MockWorkspace.latest_build,
|
||||
deadline: BASE_DEADLINE.toISOString(),
|
||||
},
|
||||
});
|
||||
}),
|
||||
);
|
||||
render(
|
||||
<ThemeProvider>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { screen } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import { MockUser, MockWorkspace } from "testHelpers/entities";
|
||||
import { renderWithWorkspaceSettingsLayout } from "testHelpers/renderHelpers";
|
||||
import { server } from "testHelpers/server";
|
||||
|
@ -253,15 +253,9 @@ describe("WorkspaceSchedulePage", () => {
|
|||
it("uses template default ttl when first enabled", async () => {
|
||||
// have autostop disabled
|
||||
server.use(
|
||||
rest.get(
|
||||
"/api/v2/users/:userId/workspace/:workspaceName",
|
||||
(req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({ ...MockWorkspace, ttl_ms: 0 }),
|
||||
);
|
||||
},
|
||||
),
|
||||
http.get("/api/v2/users/:userId/workspace/:workspaceName", () => {
|
||||
return HttpResponse.json({ ...MockWorkspace, ttl_ms: 0 });
|
||||
}),
|
||||
);
|
||||
renderWithWorkspaceSettingsLayout(<WorkspaceSchedulePage />, {
|
||||
route: `/@${MockUser.username}/${MockWorkspace.name}/schedule`,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { screen, waitFor, within } from "@testing-library/react";
|
||||
import userEvent from "@testing-library/user-event";
|
||||
import { rest } from "msw";
|
||||
import { HttpResponse, http } from "msw";
|
||||
import * as API from "api/api";
|
||||
import type { Workspace } from "api/typesGenerated";
|
||||
import {
|
||||
|
@ -30,8 +30,8 @@ describe("WorkspacesPage", () => {
|
|||
it("renders an empty workspaces page", async () => {
|
||||
// Given
|
||||
server.use(
|
||||
rest.get("/api/v2/workspaces", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json({ workspaces: [], count: 0 }));
|
||||
http.get("/api/v2/workspaces", async () => {
|
||||
return HttpResponse.json({ workspaces: [], count: 0 });
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import fs from "fs";
|
||||
import { rest } from "msw";
|
||||
import { http, HttpResponse } from "msw";
|
||||
import path from "path";
|
||||
import type { CreateWorkspaceBuildRequest } from "api/typesGenerated";
|
||||
import { permissionsToCheck } from "contexts/auth/permissions";
|
||||
|
@ -7,193 +7,148 @@ import * as M from "./entities";
|
|||
import { MockGroup, MockWorkspaceQuota } from "./entities";
|
||||
|
||||
export const handlers = [
|
||||
rest.get("/api/v2/templates/:templateId/daus", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockTemplateDAUResponse));
|
||||
http.get("/api/v2/templates/:templateId/daus", () => {
|
||||
return HttpResponse.json(M.MockTemplateDAUResponse);
|
||||
}),
|
||||
|
||||
rest.get("/api/v2/insights/daus", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockDeploymentDAUResponse));
|
||||
http.get("/api/v2/insights/daus", () => {
|
||||
return HttpResponse.json(M.MockDeploymentDAUResponse);
|
||||
}),
|
||||
// Workspace proxies
|
||||
rest.get("/api/v2/regions", async (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
regions: M.MockWorkspaceProxies,
|
||||
}),
|
||||
);
|
||||
http.get("/api/v2/regions", () => {
|
||||
return HttpResponse.json({
|
||||
regions: M.MockWorkspaceProxies,
|
||||
});
|
||||
}),
|
||||
rest.get("/api/v2/workspaceproxies", async (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
regions: M.MockWorkspaceProxies,
|
||||
}),
|
||||
);
|
||||
http.get("/api/v2/workspaceproxies", () => {
|
||||
return HttpResponse.json({
|
||||
regions: M.MockWorkspaceProxies,
|
||||
});
|
||||
}),
|
||||
// build info
|
||||
rest.get("/api/v2/buildinfo", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockBuildInfo));
|
||||
http.get("/api/v2/buildinfo", () => {
|
||||
return HttpResponse.json(M.MockBuildInfo);
|
||||
}),
|
||||
|
||||
// experiments
|
||||
rest.get("/api/v2/experiments", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockExperiments));
|
||||
http.get("/api/v2/experiments", () => {
|
||||
return HttpResponse.json(M.MockExperiments);
|
||||
}),
|
||||
|
||||
// update check
|
||||
rest.get("/api/v2/updatecheck", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockUpdateCheck));
|
||||
http.get("/api/v2/updatecheck", () => {
|
||||
return HttpResponse.json(M.MockUpdateCheck);
|
||||
}),
|
||||
|
||||
// organizations
|
||||
rest.get("/api/v2/organizations/:organizationId", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockOrganization));
|
||||
http.get("/api/v2/organizations/:organizationId", () => {
|
||||
return HttpResponse.json(M.MockOrganization);
|
||||
}),
|
||||
rest.get(
|
||||
"api/v2/organizations/:organizationId/templates/examples",
|
||||
(req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json([M.MockTemplateExample, M.MockTemplateExample2]),
|
||||
);
|
||||
},
|
||||
),
|
||||
rest.get(
|
||||
http.get("api/v2/organizations/:organizationId/templates/examples", () => {
|
||||
return HttpResponse.json([M.MockTemplateExample, M.MockTemplateExample2]);
|
||||
}),
|
||||
http.get(
|
||||
"/api/v2/organizations/:organizationId/templates/:templateId",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockTemplate));
|
||||
},
|
||||
),
|
||||
rest.get(
|
||||
"/api/v2/organizations/:organizationId/templates",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json([M.MockTemplate]));
|
||||
() => {
|
||||
return HttpResponse.json(M.MockTemplate);
|
||||
},
|
||||
),
|
||||
http.get("/api/v2/organizations/:organizationId/templates", () => {
|
||||
return HttpResponse.json([M.MockTemplate]);
|
||||
}),
|
||||
|
||||
// templates
|
||||
rest.get("/api/v2/templates/:templateId", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockTemplate));
|
||||
http.get("/api/v2/templates/:templateId", () => {
|
||||
return HttpResponse.json(M.MockTemplate);
|
||||
}),
|
||||
rest.get("/api/v2/templates/:templateId/versions", async (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json([M.MockTemplateVersion2, M.MockTemplateVersion]),
|
||||
);
|
||||
http.get("/api/v2/templates/:templateId/versions", () => {
|
||||
return HttpResponse.json([M.MockTemplateVersion2, M.MockTemplateVersion]);
|
||||
}),
|
||||
rest.patch(
|
||||
"/api/v2/templates/:templateId/versions",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json({}));
|
||||
},
|
||||
),
|
||||
rest.patch("/api/v2/templates/:templateId", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockTemplate));
|
||||
http.patch("/api/v2/templates/:templateId/versions", () => {
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
}),
|
||||
rest.get(
|
||||
"/api/v2/templateversions/:templateVersionId",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockTemplateVersion));
|
||||
},
|
||||
),
|
||||
rest.get(
|
||||
"/api/v2/templateversions/:templateVersionId/resources",
|
||||
async (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json([
|
||||
M.MockWorkspaceResource,
|
||||
M.MockWorkspaceVolumeResource,
|
||||
M.MockWorkspaceImageResource,
|
||||
M.MockWorkspaceContainerResource,
|
||||
]),
|
||||
);
|
||||
},
|
||||
),
|
||||
rest.get(
|
||||
http.patch("/api/v2/templates/:templateId", () => {
|
||||
return HttpResponse.json(M.MockTemplate);
|
||||
}),
|
||||
http.get("/api/v2/templateversions/:templateVersionId", () => {
|
||||
return HttpResponse.json(M.MockTemplateVersion);
|
||||
}),
|
||||
http.get("/api/v2/templateversions/:templateVersionId/resources", () => {
|
||||
return HttpResponse.json([
|
||||
M.MockWorkspaceResource,
|
||||
M.MockWorkspaceVolumeResource,
|
||||
M.MockWorkspaceImageResource,
|
||||
M.MockWorkspaceContainerResource,
|
||||
]);
|
||||
}),
|
||||
http.get(
|
||||
"/api/v2/templateversions/:templateVersionId/rich-parameters",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json([]));
|
||||
() => {
|
||||
return HttpResponse.json([]);
|
||||
},
|
||||
),
|
||||
rest.get(
|
||||
"/api/v2/templateversions/:templateVersionId/external-auth",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json([]));
|
||||
},
|
||||
),
|
||||
rest.get(
|
||||
"/api/v2/templateversions/:templateversionId/logs",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockWorkspaceBuildLogs));
|
||||
},
|
||||
),
|
||||
rest.get(
|
||||
http.get("/api/v2/templateversions/:templateVersionId/external-auth", () => {
|
||||
return HttpResponse.json([]);
|
||||
}),
|
||||
http.get("/api/v2/templateversions/:templateversionId/logs", () => {
|
||||
return HttpResponse.json(M.MockWorkspaceBuildLogs);
|
||||
}),
|
||||
http.get(
|
||||
"api/v2/organizations/:organizationId/templates/:templateName/versions/:templateVersionName",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockTemplateVersion));
|
||||
() => {
|
||||
return HttpResponse.json(M.MockTemplateVersion);
|
||||
},
|
||||
),
|
||||
rest.get(
|
||||
http.get(
|
||||
"api/v2/organizations/:organizationId/templates/:templateName/versions/:templateVersionName/previous",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockTemplateVersion2));
|
||||
() => {
|
||||
return HttpResponse.json(M.MockTemplateVersion2);
|
||||
},
|
||||
),
|
||||
rest.delete("/api/v2/templates/:templateId", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockTemplate));
|
||||
http.delete("/api/v2/templates/:templateId", () => {
|
||||
return HttpResponse.json(M.MockTemplate);
|
||||
}),
|
||||
|
||||
// users
|
||||
rest.get("/api/v2/users", async (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
users: [M.MockUser, M.MockUser2, M.SuspendedMockUser],
|
||||
count: 26,
|
||||
}),
|
||||
);
|
||||
http.get("/api/v2/users", () => {
|
||||
return HttpResponse.json({
|
||||
users: [M.MockUser, M.MockUser2, M.SuspendedMockUser],
|
||||
count: 26,
|
||||
});
|
||||
}),
|
||||
rest.post("/api/v2/users", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockUser));
|
||||
http.post("/api/v2/users", () => {
|
||||
return HttpResponse.json(M.MockUser);
|
||||
}),
|
||||
rest.get("/api/v2/users/:userid/login-type", async (req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
login_type: "password",
|
||||
}),
|
||||
);
|
||||
http.get("/api/v2/users/:userid/login-type", () => {
|
||||
return HttpResponse.json({
|
||||
login_type: "password",
|
||||
});
|
||||
}),
|
||||
rest.get("/api/v2/users/me/organizations", (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json([M.MockOrganization]));
|
||||
http.get("/api/v2/users/me/organizations", () => {
|
||||
return HttpResponse.json([M.MockOrganization]);
|
||||
}),
|
||||
rest.get(
|
||||
"/api/v2/users/me/organizations/:organizationId",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockOrganization));
|
||||
},
|
||||
),
|
||||
rest.post("/api/v2/users/login", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockSessionToken));
|
||||
http.get("/api/v2/users/me/organizations/:organizationId", () => {
|
||||
return HttpResponse.json(M.MockOrganization);
|
||||
}),
|
||||
rest.post("/api/v2/users/logout", async (req, res, ctx) => {
|
||||
return res(ctx.status(200));
|
||||
http.post("/api/v2/users/login", () => {
|
||||
return HttpResponse.json(M.MockSessionToken);
|
||||
}),
|
||||
rest.get("/api/v2/users/me", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockUser));
|
||||
http.post("/api/v2/users/logout", () => {
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
}),
|
||||
rest.get("/api/v2/users/me/keys", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockAPIKey));
|
||||
http.get("/api/v2/users/me", () => {
|
||||
return HttpResponse.json(M.MockUser);
|
||||
}),
|
||||
rest.get("/api/v2/users/authmethods", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockAuthMethodsPasswordOnly));
|
||||
http.get("/api/v2/users/me/keys", () => {
|
||||
return HttpResponse.json(M.MockAPIKey);
|
||||
}),
|
||||
rest.get("/api/v2/users/roles", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockSiteRoles));
|
||||
http.get("/api/v2/users/authmethods", () => {
|
||||
return HttpResponse.json(M.MockAuthMethodsPasswordOnly);
|
||||
}),
|
||||
rest.post("/api/v2/authcheck", async (req, res, ctx) => {
|
||||
http.get("/api/v2/users/roles", () => {
|
||||
return HttpResponse.json(M.MockSiteRoles);
|
||||
}),
|
||||
http.post("/api/v2/authcheck", () => {
|
||||
const permissions = [
|
||||
...Object.keys(permissionsToCheck),
|
||||
"canUpdateTemplate",
|
||||
|
@ -206,246 +161,198 @@ export const handlers = [
|
|||
};
|
||||
}, {});
|
||||
|
||||
return res(ctx.status(200), ctx.json(response));
|
||||
return HttpResponse.json(response);
|
||||
}),
|
||||
rest.get("/api/v2/users/:userId/gitsshkey", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockGitSSHKey));
|
||||
http.get("/api/v2/users/:userId/gitsshkey", () => {
|
||||
return HttpResponse.json(M.MockGitSSHKey);
|
||||
}),
|
||||
http.get("/api/v2/users/:userId/workspace/:workspaceName", () => {
|
||||
return HttpResponse.json(M.MockWorkspace);
|
||||
}),
|
||||
rest.get(
|
||||
"/api/v2/users/:userId/workspace/:workspaceName",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockWorkspace));
|
||||
},
|
||||
),
|
||||
|
||||
// First user
|
||||
rest.get("/api/v2/users/first", async (req, res, ctx) => {
|
||||
return res(ctx.status(200));
|
||||
http.get("/api/v2/users/first", () => {
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
}),
|
||||
rest.post("/api/v2/users/first", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockUser));
|
||||
http.post("/api/v2/users/first", () => {
|
||||
return HttpResponse.json(M.MockUser);
|
||||
}),
|
||||
|
||||
// workspaces
|
||||
rest.get("/api/v2/workspaces", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockWorkspacesResponse));
|
||||
http.get("/api/v2/workspaces", () => {
|
||||
return HttpResponse.json(M.MockWorkspacesResponse);
|
||||
}),
|
||||
rest.get("/api/v2/workspaces/:workspaceId", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockWorkspace));
|
||||
http.get("/api/v2/workspaces/:workspaceId", () => {
|
||||
return HttpResponse.json(M.MockWorkspace);
|
||||
}),
|
||||
rest.put(
|
||||
"/api/v2/workspaces/:workspaceId/autostart",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200));
|
||||
},
|
||||
),
|
||||
rest.put("/api/v2/workspaces/:workspaceId/ttl", async (req, res, ctx) => {
|
||||
return res(ctx.status(200));
|
||||
http.put("/api/v2/workspaces/:workspaceId/autostart", () => {
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
}),
|
||||
rest.put("/api/v2/workspaces/:workspaceId/extend", async (req, res, ctx) => {
|
||||
return res(ctx.status(200));
|
||||
http.put("/api/v2/workspaces/:workspaceId/ttl", () => {
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
}),
|
||||
http.put("/api/v2/workspaces/:workspaceId/extend", () => {
|
||||
return new HttpResponse(null, { status: 200 });
|
||||
}),
|
||||
http.get("/api/v2/workspaces/:workspaceId/resolve-autostart", () => {
|
||||
return HttpResponse.json({ parameter_mismatch: false });
|
||||
}),
|
||||
rest.get(
|
||||
"/api/v2/workspaces/:workspaceId/resolve-autostart",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json({ parameter_mismatch: false }));
|
||||
},
|
||||
),
|
||||
|
||||
// workspace builds
|
||||
rest.post("/api/v2/workspaces/:workspaceId/builds", async (req, res, ctx) => {
|
||||
const { transition } = req.body as CreateWorkspaceBuildRequest;
|
||||
http.post("/api/v2/workspaces/:workspaceId/builds", async ({ request }) => {
|
||||
const { transition } =
|
||||
(await request.json()) as CreateWorkspaceBuildRequest;
|
||||
const transitionToBuild = {
|
||||
start: M.MockWorkspaceBuild,
|
||||
stop: M.MockWorkspaceBuildStop,
|
||||
delete: M.MockWorkspaceBuildDelete,
|
||||
};
|
||||
const result = transitionToBuild[transition];
|
||||
return res(ctx.status(200), ctx.json(result));
|
||||
return HttpResponse.json(result);
|
||||
}),
|
||||
rest.get("/api/v2/workspaces/:workspaceId/builds", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockBuilds));
|
||||
http.get("/api/v2/workspaces/:workspaceId/builds", () => {
|
||||
return HttpResponse.json(M.MockBuilds);
|
||||
}),
|
||||
rest.get(
|
||||
http.get("/api/v2/workspaces/:workspaceId/port-share", () => {
|
||||
return HttpResponse.json(M.MockSharedPortsResponse);
|
||||
}),
|
||||
http.get(
|
||||
"/api/v2/users/:username/workspace/:workspaceName/builds/:buildNumber",
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockWorkspaceBuild));
|
||||
() => {
|
||||
return HttpResponse.json(M.MockWorkspaceBuild);
|
||||
},
|
||||
),
|
||||
rest.get(
|
||||
"/api/v2/workspacebuilds/:workspaceBuildId/resources",
|
||||
(req, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json([
|
||||
M.MockWorkspaceResource,
|
||||
M.MockWorkspaceVolumeResource,
|
||||
M.MockWorkspaceImageResource,
|
||||
M.MockWorkspaceContainerResource,
|
||||
]),
|
||||
);
|
||||
},
|
||||
),
|
||||
rest.patch(
|
||||
"/api/v2/workspacebuilds/:workspaceBuildId/cancel",
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockCancellationMessage));
|
||||
},
|
||||
),
|
||||
rest.get(
|
||||
"/api/v2/workspacebuilds/:workspaceBuildId/logs",
|
||||
(req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockWorkspaceBuildLogs));
|
||||
},
|
||||
),
|
||||
rest.get("/api/v2/entitlements", (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockEntitlements));
|
||||
http.get("/api/v2/workspacebuilds/:workspaceBuildId/resources", () => {
|
||||
return HttpResponse.json([
|
||||
M.MockWorkspaceResource,
|
||||
M.MockWorkspaceVolumeResource,
|
||||
M.MockWorkspaceImageResource,
|
||||
M.MockWorkspaceContainerResource,
|
||||
]);
|
||||
}),
|
||||
http.patch("/api/v2/workspacebuilds/:workspaceBuildId/cancel", () => {
|
||||
return HttpResponse.json(M.MockCancellationMessage);
|
||||
}),
|
||||
http.get("/api/v2/workspacebuilds/:workspaceBuildId/logs", () => {
|
||||
return HttpResponse.json(M.MockWorkspaceBuildLogs);
|
||||
}),
|
||||
http.get("/api/v2/entitlements", () => {
|
||||
return HttpResponse.json(M.MockEntitlements);
|
||||
}),
|
||||
|
||||
// Audit
|
||||
rest.get("/api/v2/audit", (req, res, ctx) => {
|
||||
const filter = req.url.searchParams.get("q") as string;
|
||||
http.get("/api/v2/audit", ({ request }) => {
|
||||
const { searchParams } = new URL(request.url);
|
||||
const filter = searchParams.get("q") as string;
|
||||
const logs =
|
||||
filter === "resource_type:workspace action:create"
|
||||
? [M.MockAuditLog]
|
||||
: [M.MockAuditLog, M.MockAuditLog2];
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
audit_logs: logs,
|
||||
count: logs.length,
|
||||
}),
|
||||
);
|
||||
return HttpResponse.json({
|
||||
audit_logs: logs,
|
||||
count: logs.length,
|
||||
});
|
||||
}),
|
||||
|
||||
// Applications host
|
||||
rest.get("/api/v2/applications/host", (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json({ host: "*.dev.coder.com" }));
|
||||
http.get("/api/v2/applications/host", () => {
|
||||
return HttpResponse.json({ host: "*.dev.coder.com" });
|
||||
}),
|
||||
|
||||
// Groups
|
||||
rest.get("/api/v2/organizations/:organizationId/groups", (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json([MockGroup]));
|
||||
http.get("/api/v2/organizations/:organizationId/groups", () => {
|
||||
return HttpResponse.json([MockGroup]);
|
||||
}),
|
||||
|
||||
rest.post(
|
||||
"/api/v2/organizations/:organizationId/groups",
|
||||
async (req, res, ctx) => {
|
||||
return res(ctx.status(201), ctx.json(M.MockGroup));
|
||||
},
|
||||
),
|
||||
|
||||
rest.get("/api/v2/groups/:groupId", (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(MockGroup));
|
||||
http.post("/api/v2/organizations/:organizationId/groups", () => {
|
||||
return HttpResponse.json(M.MockGroup, { status: 201 });
|
||||
}),
|
||||
|
||||
rest.patch("/api/v2/groups/:groupId", (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(MockGroup));
|
||||
http.get("/api/v2/groups/:groupId", () => {
|
||||
return HttpResponse.json(MockGroup);
|
||||
}),
|
||||
|
||||
rest.delete("/api/v2/groups/:groupId", (req, res, ctx) => {
|
||||
return res(ctx.status(204));
|
||||
http.patch("/api/v2/groups/:groupId", () => {
|
||||
return HttpResponse.json(MockGroup);
|
||||
}),
|
||||
|
||||
rest.get("/api/v2/workspace-quota/:userId", (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(MockWorkspaceQuota));
|
||||
http.delete("/api/v2/groups/:groupId", () => {
|
||||
return new HttpResponse(null, { status: 204 });
|
||||
}),
|
||||
|
||||
rest.get("/api/v2/appearance", (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockAppearanceConfig));
|
||||
http.get("/api/v2/workspace-quota/:userId", () => {
|
||||
return HttpResponse.json(MockWorkspaceQuota);
|
||||
}),
|
||||
|
||||
rest.get("/api/v2/deployment/stats", (_, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockDeploymentStats));
|
||||
http.get("/api/v2/appearance", () => {
|
||||
return HttpResponse.json(M.MockAppearanceConfig);
|
||||
}),
|
||||
|
||||
rest.get("/api/v2/deployment/config", (_, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockDeploymentConfig));
|
||||
http.get("/api/v2/deployment/stats", () => {
|
||||
return HttpResponse.json(M.MockDeploymentStats);
|
||||
}),
|
||||
|
||||
rest.get(
|
||||
"/api/v2/workspacebuilds/:workspaceBuildId/parameters",
|
||||
(_, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json([
|
||||
M.MockWorkspaceBuildParameter1,
|
||||
M.MockWorkspaceBuildParameter2,
|
||||
M.MockWorkspaceBuildParameter3,
|
||||
M.MockWorkspaceBuildParameter4,
|
||||
M.MockWorkspaceBuildParameter5,
|
||||
]),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
rest.post("/api/v2/files", (_, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json({
|
||||
hash: "some-file-hash",
|
||||
}),
|
||||
);
|
||||
http.get("/api/v2/deployment/config", () => {
|
||||
return HttpResponse.json(M.MockDeploymentConfig);
|
||||
}),
|
||||
|
||||
rest.get("/api/v2/files/:fileId", (_, res, ctx) => {
|
||||
http.get("/api/v2/workspacebuilds/:workspaceBuildId/parameters", () => {
|
||||
return HttpResponse.json([
|
||||
M.MockWorkspaceBuildParameter1,
|
||||
M.MockWorkspaceBuildParameter2,
|
||||
M.MockWorkspaceBuildParameter3,
|
||||
M.MockWorkspaceBuildParameter4,
|
||||
M.MockWorkspaceBuildParameter5,
|
||||
]);
|
||||
}),
|
||||
|
||||
http.post("/api/v2/files", () => {
|
||||
return HttpResponse.json({
|
||||
hash: "some-file-hash",
|
||||
});
|
||||
}),
|
||||
|
||||
http.get("/api/v2/files/:fileId", () => {
|
||||
const fileBuffer = fs.readFileSync(
|
||||
path.resolve(__dirname, "./templateFiles.tar"),
|
||||
);
|
||||
|
||||
return res(
|
||||
ctx.set("Content-Length", fileBuffer.byteLength.toString()),
|
||||
ctx.set("Content-Type", "application/octet-stream"),
|
||||
// Respond with the "ArrayBuffer".
|
||||
ctx.body(fileBuffer),
|
||||
);
|
||||
return HttpResponse.arrayBuffer(fileBuffer);
|
||||
}),
|
||||
|
||||
rest.get(
|
||||
"/api/v2/templateversions/:templateVersionId/parameters",
|
||||
(_, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json([
|
||||
M.MockTemplateVersionParameter1,
|
||||
M.MockTemplateVersionParameter2,
|
||||
M.MockTemplateVersionParameter3,
|
||||
]),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
rest.get(
|
||||
"/api/v2/templateversions/:templateVersionId/variables",
|
||||
(_, res, ctx) => {
|
||||
return res(
|
||||
ctx.status(200),
|
||||
ctx.json([
|
||||
M.MockTemplateVersionVariable1,
|
||||
M.MockTemplateVersionVariable2,
|
||||
M.MockTemplateVersionVariable3,
|
||||
]),
|
||||
);
|
||||
},
|
||||
),
|
||||
|
||||
rest.get("/api/v2/deployment/ssh", (_, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockDeploymentSSH));
|
||||
http.get("/api/v2/templateversions/:templateVersionId/parameters", () => {
|
||||
return HttpResponse.json([
|
||||
M.MockTemplateVersionParameter1,
|
||||
M.MockTemplateVersionParameter2,
|
||||
M.MockTemplateVersionParameter3,
|
||||
]);
|
||||
}),
|
||||
|
||||
rest.get("/api/v2/workspaceagents/:agent/logs", (_, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockWorkspaceAgentLogs));
|
||||
http.get("/api/v2/templateversions/:templateVersionId/variables", () => {
|
||||
return HttpResponse.json([
|
||||
M.MockTemplateVersionVariable1,
|
||||
M.MockTemplateVersionVariable2,
|
||||
M.MockTemplateVersionVariable3,
|
||||
]);
|
||||
}),
|
||||
|
||||
rest.get("/api/v2/debug/health", (_, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockHealth));
|
||||
http.get("/api/v2/deployment/ssh", () => {
|
||||
return HttpResponse.json(M.MockDeploymentSSH);
|
||||
}),
|
||||
|
||||
rest.get("/api/v2/workspaceagents/:agent/listening-ports", (_, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockListeningPortsResponse));
|
||||
http.get("/api/v2/workspaceagents/:agent/logs", () => {
|
||||
return HttpResponse.json(M.MockWorkspaceAgentLogs);
|
||||
}),
|
||||
|
||||
rest.get("/api/v2/integrations/jfrog/xray-scan", (_, res, ctx) => {
|
||||
return res(ctx.status(404));
|
||||
http.get("/api/v2/debug/health", () => {
|
||||
return HttpResponse.json(M.MockHealth);
|
||||
}),
|
||||
|
||||
http.get("/api/v2/workspaceagents/:agent/listening-ports", () => {
|
||||
return HttpResponse.json(M.MockListeningPortsResponse);
|
||||
}),
|
||||
|
||||
http.get("/api/v2/integrations/jfrog/xray-scan", () => {
|
||||
return new HttpResponse(null, { status: 404 });
|
||||
}),
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue