mirror of
https://github.com/coder/coder.git
synced 2026-09-24 15:04:27 +08:00
chore: Remove unused test files and code (#5130)
This commit is contained in:
+1
-13
@@ -18,7 +18,6 @@ module.exports = {
|
||||
coverageReporters: ["text", "lcov"],
|
||||
displayName: "test",
|
||||
preset: "ts-jest",
|
||||
|
||||
roots: ["<rootDir>"],
|
||||
setupFilesAfterEnv: ["./jest.setup.ts"],
|
||||
transform: {
|
||||
@@ -26,7 +25,7 @@ module.exports = {
|
||||
},
|
||||
testEnvironment: "jsdom",
|
||||
testRegex: "(/__tests__/.*|(\\.|/)(test|spec))\\.tsx?$",
|
||||
testPathIgnorePatterns: ["/node_modules/", "/__tests__/fakes", "/e2e/"],
|
||||
testPathIgnorePatterns: ["/node_modules/", "/e2e/"],
|
||||
moduleDirectories: ["node_modules", "<rootDir>/src"],
|
||||
moduleNameMapper: {
|
||||
"\\.css$": "<rootDir>/src/testHelpers/styleMock.ts",
|
||||
@@ -63,15 +62,4 @@ module.exports = {
|
||||
"!<rootDir>/out/**/*.*",
|
||||
"!<rootDir>/storybook-static/**/*.*",
|
||||
],
|
||||
reporters: [
|
||||
"default",
|
||||
[
|
||||
"jest-junit",
|
||||
{
|
||||
suiteName: "Front-end Jest Tests",
|
||||
outputDirectory: "./test-results",
|
||||
outputName: "junit.xml",
|
||||
},
|
||||
],
|
||||
],
|
||||
}
|
||||
|
||||
+1
-3
@@ -62,7 +62,6 @@
|
||||
"react-syntax-highlighter": "15.5.0",
|
||||
"remark-gfm": "3.0.1",
|
||||
"sourcemapped-stacktrace": "1.1.11",
|
||||
"swr": "1.3.0",
|
||||
"tzdata": "1.0.30",
|
||||
"ua-parser-js": "1.0.2",
|
||||
"uuid": "9.0.0",
|
||||
@@ -104,7 +103,7 @@
|
||||
"eslint-import-resolver-alias": "1.1.2",
|
||||
"eslint-import-resolver-typescript": "3.5.0",
|
||||
"eslint-plugin-compat": "4.0.2",
|
||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||
"eslint-plugin-eslint-comments": "3.2.0",
|
||||
"eslint-plugin-import": "2.26.0",
|
||||
"eslint-plugin-jest": "27.0.1",
|
||||
"eslint-plugin-jsx-a11y": "6.6.1",
|
||||
@@ -114,7 +113,6 @@
|
||||
"eslint-plugin-unicorn": "44.0.0",
|
||||
"jest": "27.5.1",
|
||||
"jest-canvas-mock": "2.4.0",
|
||||
"jest-junit": "14.0.0",
|
||||
"jest-runner-eslint": "1.1.0",
|
||||
"jest-websocket-mock": "2.4.0",
|
||||
"msw": "0.47.0",
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
/* eslint-disable @typescript-eslint/no-floating-promises -- TODO look into this */
|
||||
import { fireEvent, screen, waitFor, within } from "@testing-library/react"
|
||||
import userEvent from "@testing-library/user-event"
|
||||
import EventSourceMock from "eventsourcemock"
|
||||
@@ -25,6 +24,7 @@ import {
|
||||
MockWorkspaceBuild,
|
||||
MockWorkspaceResource2,
|
||||
renderWithAuth,
|
||||
waitForLoaderToBeRemoved,
|
||||
} from "../../testHelpers/renderHelpers"
|
||||
import { server } from "../../testHelpers/server"
|
||||
import { WorkspacePage } from "./WorkspacePage"
|
||||
@@ -33,15 +33,12 @@ const { t } = i18next
|
||||
|
||||
// It renders the workspace page and waits for it be loaded
|
||||
const renderWorkspacePage = async () => {
|
||||
const getTemplateMock = jest
|
||||
.spyOn(api, "getTemplate")
|
||||
.mockResolvedValueOnce(MockTemplate)
|
||||
jest.spyOn(api, "getTemplate").mockResolvedValueOnce(MockTemplate)
|
||||
renderWithAuth(<WorkspacePage />, {
|
||||
route: `/@${MockWorkspace.owner_name}/${MockWorkspace.name}`,
|
||||
path: "/@:username/:workspace",
|
||||
})
|
||||
await screen.findByText(MockWorkspace.name)
|
||||
expect(getTemplateMock).toBeCalled()
|
||||
await waitForLoaderToBeRemoved()
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,12 +47,9 @@ const renderWorkspacePage = async () => {
|
||||
* We don't need to test the UI exhaustively because Storybook does that; just enough to prove that the
|
||||
* workspaceStatus was calculated correctly.
|
||||
*/
|
||||
|
||||
const testButton = async (label: string, actionMock: jest.SpyInstance) => {
|
||||
await renderWorkspacePage()
|
||||
// REMARK: exact here because the "Start" button and "START" label for
|
||||
// workspace schedule could otherwise conflict.
|
||||
const button = await screen.findByText(label, { exact: true })
|
||||
const button = await screen.findByRole("button", { name: label })
|
||||
fireEvent.click(button)
|
||||
expect(actionMock).toBeCalled()
|
||||
}
|
||||
@@ -318,11 +312,7 @@ describe("WorkspacePage", () => {
|
||||
),
|
||||
)
|
||||
|
||||
renderWithAuth(<WorkspacePage />, {
|
||||
route: `/@${MockWorkspace.owner_name}/${MockWorkspace.name}`,
|
||||
path: "/@:username/:workspace",
|
||||
})
|
||||
|
||||
await renderWorkspacePage()
|
||||
const agent1Names = await screen.findAllByText(MockWorkspaceAgent.name)
|
||||
expect(agent1Names.length).toEqual(1)
|
||||
const agent2Names = await screen.findAllByText(
|
||||
@@ -351,4 +341,3 @@ describe("WorkspacePage", () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
/* eslint-enable @typescript-eslint/no-floating-promises -- TODO look into this */
|
||||
|
||||
@@ -83,6 +83,9 @@ export const handlers = [
|
||||
}),
|
||||
)
|
||||
}),
|
||||
rest.post("/api/v2/users", async (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json(M.MockUser))
|
||||
}),
|
||||
rest.get("/api/v2/users/me/organizations", (req, res, ctx) => {
|
||||
return res(ctx.status(200), ctx.json([M.MockOrganization]))
|
||||
}),
|
||||
|
||||
+1
-26
@@ -6421,7 +6421,7 @@ eslint-plugin-compat@4.0.2:
|
||||
lodash.memoize "4.1.2"
|
||||
semver "7.3.5"
|
||||
|
||||
eslint-plugin-eslint-comments@^3.2.0:
|
||||
eslint-plugin-eslint-comments@3.2.0:
|
||||
version "3.2.0"
|
||||
resolved "https://registry.yarnpkg.com/eslint-plugin-eslint-comments/-/eslint-plugin-eslint-comments-3.2.0.tgz#9e1cd7b4413526abb313933071d7aba05ca12ffa"
|
||||
integrity sha512-0jkOl0hfojIHHmEHgmNdqv4fmh7300NdpA9FFpF7zaoLvB/QeXOGNLIo86oAveJFrfB1p05kC8hpEMHM8DwWVQ==
|
||||
@@ -8745,16 +8745,6 @@ jest-jasmine2@^27.5.1:
|
||||
pretty-format "^27.5.1"
|
||||
throat "^6.0.1"
|
||||
|
||||
jest-junit@14.0.0:
|
||||
version "14.0.0"
|
||||
resolved "https://registry.yarnpkg.com/jest-junit/-/jest-junit-14.0.0.tgz#f69fc31bab32224848f443480c2c808fccb2a802"
|
||||
integrity sha512-kALvBDegstTROfDGXH71UGD7k5g7593Y1wuX1wpWT+QTYcBbmtuGOA8UlAt56zo/B2eMIOcaOVEON3j0VXVa4g==
|
||||
dependencies:
|
||||
mkdirp "^1.0.4"
|
||||
strip-ansi "^6.0.1"
|
||||
uuid "^8.3.2"
|
||||
xml "^1.0.1"
|
||||
|
||||
jest-leak-detector@^27.5.1:
|
||||
version "27.5.1"
|
||||
resolved "https://registry.yarnpkg.com/jest-leak-detector/-/jest-leak-detector-27.5.1.tgz#6ec9d54c3579dd6e3e66d70e3498adf80fde3fb8"
|
||||
@@ -12902,11 +12892,6 @@ supports-preserve-symlinks-flag@^1.0.0:
|
||||
resolved "https://registry.yarnpkg.com/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz#6eda4bd344a3c94aea376d4cc31bc77311039e09"
|
||||
integrity sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==
|
||||
|
||||
swr@1.3.0:
|
||||
version "1.3.0"
|
||||
resolved "https://registry.yarnpkg.com/swr/-/swr-1.3.0.tgz#c6531866a35b4db37b38b72c45a63171faf9f4e8"
|
||||
integrity sha512-dkghQrOl2ORX9HYrMDtPa7LTVHJjCTeZoB1dqTbnnEDlSvN8JEKpYIYurDfvbQFUUS8Cg8PceFVZNkW0KNNYPw==
|
||||
|
||||
symbol-tree@^3.2.4:
|
||||
version "3.2.4"
|
||||
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
|
||||
@@ -13730,11 +13715,6 @@ uuid@^3.3.2:
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-3.4.0.tgz#b23e4358afa8a202fe7a100af1f5f883f02007ee"
|
||||
integrity sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==
|
||||
|
||||
uuid@^8.3.2:
|
||||
version "8.3.2"
|
||||
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
|
||||
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
|
||||
|
||||
uvu@^0.5.0:
|
||||
version "0.5.6"
|
||||
resolved "https://registry.yarnpkg.com/uvu/-/uvu-0.5.6.tgz#2754ca20bcb0bb59b64e9985e84d2e81058502df"
|
||||
@@ -14199,11 +14179,6 @@ xml-name-validator@^3.0.0:
|
||||
resolved "https://registry.yarnpkg.com/xml-name-validator/-/xml-name-validator-3.0.0.tgz#6ae73e06de4d8c6e47f9fb181f78d648ad457c6a"
|
||||
integrity sha512-A5CUptxDsvxKJEU3yO6DuWBSJz/qizqzJKOMIfUJHETbBw/sFaDxgd6fxm1ewUaM0jZ444Fc5vC5ROYurg/4Pw==
|
||||
|
||||
xml@^1.0.1:
|
||||
version "1.0.1"
|
||||
resolved "https://registry.yarnpkg.com/xml/-/xml-1.0.1.tgz#78ba72020029c5bc87b8a81a3cfcd74b4a2fc1e5"
|
||||
integrity sha512-huCv9IH9Tcf95zuYCsQraZtWnJvBtLVE0QHMOs8bWyZAFZNDcYjsPq1nEx8jKA9y+Beo9v+7OBPRisQTjinQMw==
|
||||
|
||||
xmlchars@^2.2.0:
|
||||
version "2.2.0"
|
||||
resolved "https://registry.yarnpkg.com/xmlchars/-/xmlchars-2.2.0.tgz#060fe1bcb7f9c76fe2a17db86a9bc3ab894210cb"
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
||||
# yarn lockfile v1
|
||||
|
||||
|
||||
js-untar@^2.0.0:
|
||||
version "2.0.0"
|
||||
resolved "https://registry.yarnpkg.com/js-untar/-/js-untar-2.0.0.tgz#b452d28dedd3b0be92c2ac9a7d70f612a93c7453"
|
||||
integrity sha512-7CsDLrYQMbLxDt2zl9uKaPZSdmJMvGGQ7wo9hoB3J+z/VcO2w63bXFgHVnjF1+S9wD3zAu8FBVj7EYWjTQ3Z7g==
|
||||
Reference in New Issue
Block a user