Skip to content
This repository was archived by the owner on May 15, 2025. It is now read-only.

Commit 438c904

Browse files
authored
chore: cleanup all test files (#293)
## Changes made - Removed all unused imports, and made sure type imports were labeled correctly - Updated all comparisons to be more strict - Simplified loops to remove unneeded closure functions - Removed all explicit `any` types - Updated how strings were defined to follow general TypeScript best practices ## Notes - We definitely want some kind of linting setup for this repo. I'm going to bring this up when Blueberry has its next team meeting next week
1 parent bd6747f commit 438c904

File tree

16 files changed

+52
-55
lines changed

16 files changed

+52
-55
lines changed

aws-region/main.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { describe, expect, it } from "bun:test";
22
import {
3-
executeScriptInContainer,
43
runTerraformApply,
54
runTerraformInit,
65
testRequiredVariables,

azure-region/main.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { describe, expect, it } from "bun:test";
22
import {
3-
executeScriptInContainer,
43
runTerraformApply,
54
runTerraformInit,
65
testRequiredVariables,

coder-login/main.test.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
import { describe, expect, it } from "bun:test";
2-
import {
3-
executeScriptInContainer,
4-
runTerraformApply,
5-
runTerraformInit,
6-
testRequiredVariables,
7-
} from "../test";
1+
import { describe } from "bun:test";
2+
import { runTerraformInit, testRequiredVariables } from "../test";
83

94
describe("coder-login", async () => {
105
await runTerraformInit(import.meta.dir);

cursor/main.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { describe, expect, it } from "bun:test";
22
import {
3-
executeScriptInContainer,
43
runTerraformApply,
54
runTerraformInit,
65
testRequiredVariables,

exoscale-zone/main.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { describe, expect, it } from "bun:test";
22
import {
3-
executeScriptInContainer,
43
runTerraformApply,
54
runTerraformInit,
65
testRequiredVariables,

github-upload-public-key/main.test.ts

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { type Server, serve } from "bun";
12
import { describe, expect, it } from "bun:test";
23
import {
34
createJSONResponse,
@@ -9,7 +10,6 @@ import {
910
testRequiredVariables,
1011
writeCoder,
1112
} from "../test";
12-
import { Server, serve } from "bun";
1313

1414
describe("github-upload-public-key", async () => {
1515
await runTerraformInit(import.meta.dir);
@@ -21,10 +21,12 @@ describe("github-upload-public-key", async () => {
2121
it("creates new key if one does not exist", async () => {
2222
const { instance, id, server } = await setupContainer();
2323
await writeCoder(id, "echo foo");
24-
let exec = await execContainer(id, [
24+
25+
const url = server.url.toString().slice(0, -1);
26+
const exec = await execContainer(id, [
2527
"env",
26-
"CODER_ACCESS_URL=" + server.url.toString().slice(0, -1),
27-
"GITHUB_API_URL=" + server.url.toString().slice(0, -1),
28+
`CODER_ACCESS_URL=${url}`,
29+
`GITHUB_API_URL=${url}`,
2830
"CODER_OWNER_SESSION_TOKEN=foo",
2931
"CODER_EXTERNAL_AUTH_ID=github",
3032
"bash",
@@ -42,10 +44,12 @@ describe("github-upload-public-key", async () => {
4244
const { instance, id, server } = await setupContainer();
4345
// use keyword to make server return a existing key
4446
await writeCoder(id, "echo findkey");
45-
let exec = await execContainer(id, [
47+
48+
const url = server.url.toString().slice(0, -1);
49+
const exec = await execContainer(id, [
4650
"env",
47-
"CODER_ACCESS_URL=" + server.url.toString().slice(0, -1),
48-
"GITHUB_API_URL=" + server.url.toString().slice(0, -1),
51+
`CODER_ACCESS_URL=${url}`,
52+
`GITHUB_API_URL=${url}`,
4953
"CODER_OWNER_SESSION_TOKEN=foo",
5054
"CODER_EXTERNAL_AUTH_ID=github",
5155
"bash",
@@ -95,7 +99,7 @@ const setupServer = async (): Promise<Server> => {
9599
}
96100

97101
// case: key already exists
98-
if (req.headers.get("Authorization") == "Bearer findkey") {
102+
if (req.headers.get("Authorization") === "Bearer findkey") {
99103
return createJSONResponse([
100104
{
101105
key: "foo",

jfrog-oauth/main.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ EOF`;
116116
const proxies = ["foo", "bar", "baz"]
117117
.map((r) => `https://${user}:@${fakeFrogApi}/go/${r}`)
118118
.join(",");
119-
expect(proxyEnv["value"]).toEqual(proxies);
119+
expect(proxyEnv.value).toEqual(proxies);
120120

121121
const coderScript = findResourceInstance(state, "coder_script");
122122
expect(coderScript.script).toContain(

jfrog-token/main.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ EOF`;
151151
const proxies = ["foo", "bar", "baz"]
152152
.map((r) => `https://${user}:${token}@${fakeFrogApi}/go/${r}`)
153153
.join(",");
154-
expect(proxyEnv["value"]).toEqual(proxies);
154+
expect(proxyEnv.value).toEqual(proxies);
155155

156156
const coderScript = findResourceInstance(state, "coder_script");
157157
expect(coderScript.script).toContain(

jupyterlab/main.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,20 @@
11
import { describe, expect, it } from "bun:test";
22
import {
3+
execContainer,
34
executeScriptInContainer,
5+
findResourceInstance,
6+
runContainer,
47
runTerraformApply,
58
runTerraformInit,
69
testRequiredVariables,
7-
findResourceInstance,
8-
runContainer,
9-
TerraformState,
10-
execContainer,
10+
type TerraformState,
1111
} from "../test";
1212

1313
// executes the coder script after installing pip
1414
const executeScriptInContainerWithPip = async (
1515
state: TerraformState,
1616
image: string,
17-
shell: string = "sh",
17+
shell = "sh",
1818
): Promise<{
1919
exitCode: number;
2020
stdout: string[];

nodejs/main.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, expect, it } from "bun:test";
1+
import { describe } from "bun:test";
22
import { runTerraformInit, testRequiredVariables } from "../test";
33

44
describe("nodejs", async () => {

0 commit comments

Comments
 (0)