Skip to content

Commit 9aad95b

Browse files
committed
fixup! refactor: delete unused code
1 parent 01a4285 commit 9aad95b

File tree

2 files changed

+1
-80
lines changed

2 files changed

+1
-80
lines changed

test/unit/common/util.test.ts

-47
Original file line numberDiff line numberDiff line change
@@ -24,16 +24,6 @@ describe("util", () => {
2424
})
2525
})
2626

27-
describe("split", () => {
28-
it("should split at a comma", () => {
29-
expect(util.split("Hello,world", ",")).toStrictEqual(["Hello", "world"])
30-
})
31-
32-
it("shouldn't split if the delimiter doesn't exist", () => {
33-
expect(util.split("Hello world", ",")).toStrictEqual(["Hello world", ""])
34-
})
35-
})
36-
3727
describe("plural", () => {
3828
it("should add an s if count is greater than 1", () => {
3929
expect(util.plural(2, "dog")).toBe("dogs")
@@ -57,43 +47,6 @@ describe("util", () => {
5747
})
5848
})
5949

60-
describe("trimSlashes", () => {
61-
it("should remove leading slashes", () => {
62-
expect(util.trimSlashes("/hello-world")).toBe("hello-world")
63-
})
64-
65-
it("should remove trailing slashes", () => {
66-
expect(util.trimSlashes("hello-world/")).toBe("hello-world")
67-
})
68-
69-
it("should remove both leading and trailing slashes", () => {
70-
expect(util.trimSlashes("/hello-world/")).toBe("hello-world")
71-
})
72-
73-
it("should remove multiple leading and trailing slashes", () => {
74-
expect(util.trimSlashes("///hello-world////")).toBe("hello-world")
75-
})
76-
})
77-
78-
describe("arrayify", () => {
79-
it("should return value it's already an array", () => {
80-
expect(util.arrayify(["hello", "world"])).toStrictEqual(["hello", "world"])
81-
})
82-
83-
it("should wrap the value in an array if not an array", () => {
84-
expect(
85-
util.arrayify({
86-
name: "Coder",
87-
version: "3.8",
88-
}),
89-
).toStrictEqual([{ name: "Coder", version: "3.8" }])
90-
})
91-
92-
it("should return an empty array if the value is undefined", () => {
93-
expect(util.arrayify(undefined)).toStrictEqual([])
94-
})
95-
})
96-
9750
describe("logError", () => {
9851
beforeAll(() => {
9952
mockLogger()

test/unit/node/app.test.ts

+1-33
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { promises } from "fs"
33
import * as http from "http"
44
import * as https from "https"
55
import * as path from "path"
6-
import { createApp, ensureAddress, handleArgsSocketCatchError, handleServerError, listen } from "../../../src/node/app"
6+
import { createApp, ensureAddress, handleArgsSocketCatchError, listen } from "../../../src/node/app"
77
import { OptionalString, setDefaults } from "../../../src/node/cli"
88
import { generateCertificate } from "../../../src/node/util"
99
import { clean, mockLogger, getAvailablePort, tmpdir } from "../../utils/helpers"
@@ -169,38 +169,6 @@ describe("ensureAddress", () => {
169169
})
170170
})
171171

172-
describe("handleServerError", () => {
173-
beforeAll(() => {
174-
mockLogger()
175-
})
176-
177-
afterEach(() => {
178-
jest.clearAllMocks()
179-
})
180-
181-
it("should call reject if resolved is false", async () => {
182-
const resolved = false
183-
const reject = jest.fn((err: Error) => undefined)
184-
const error = new Error("handleServerError Error")
185-
186-
handleServerError(resolved, error, reject)
187-
188-
expect(reject).toHaveBeenCalledTimes(1)
189-
expect(reject).toHaveBeenCalledWith(error)
190-
})
191-
192-
it("should log an error if resolved is true", async () => {
193-
const resolved = true
194-
const reject = jest.fn((err: Error) => undefined)
195-
const error = new Error("handleServerError Error")
196-
197-
handleServerError(resolved, error, reject)
198-
199-
expect(logger.error).toHaveBeenCalledTimes(1)
200-
expect(logger.error).toHaveBeenCalledWith(`http server error: ${error.message} ${error.stack}`)
201-
})
202-
})
203-
204172
describe("handleArgsSocketCatchError", () => {
205173
beforeAll(() => {
206174
mockLogger()

0 commit comments

Comments
 (0)