Skip to content

Commit 5ab9c88

Browse files
authored
fix unit tests verifyCommand.test.ts
1 parent 8d40a99 commit 5ab9c88

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

tests/unit/handlers/verifyCommand.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import config from "../../../config/config";
77
import {
88
UNIQUE_TOKEN,
99
discordUserData,
10-
env,
1110
mockDateNow,
1211
} from "../../fixtures/fixture";
12+
import { mockEnv } from "../mockEnv";
1313

1414
describe("verifyCommand", () => {
1515
beforeEach(() => {
@@ -41,7 +41,7 @@ describe("verifyCommand", () => {
4141
"userName",
4242
"discriminator",
4343
"2021-07-25T19:25:16.172000+00:00",
44-
env
44+
mockEnv
4545
);
4646

4747
expect(global.fetch).toHaveBeenCalledWith(
@@ -50,15 +50,15 @@ describe("verifyCommand", () => {
5050
method: "POST",
5151
headers: {
5252
"Content-Type": "application/json",
53-
Authorization: `Bearer ${env.DISCORD_TOKEN}`,
53+
Authorization: `Bearer ${mockEnv.DISCORD_TOKEN}`,
5454
},
5555
body: JSON.stringify(discordUserData),
5656
}
5757
);
5858
const resultText = await result.text();
5959
const resultData = JSON.parse(resultText);
6060

61-
const verificationSiteURL = config(env).VERIFICATION_SITE_URL;
61+
const verificationSiteURL = config(mockEnv).VERIFICATION_SITE_URL;
6262
const message = `${VERIFICATION_STRING}\n${verificationSiteURL}/discord?token=${UNIQUE_TOKEN}\n${VERIFICATION_SUBSTRING}`;
6363
expect(resultData.data.content).toEqual(message);
6464
});
@@ -79,7 +79,7 @@ describe("verifyCommand", () => {
7979
"test user",
8080
"sndbhsbgdj",
8181
"2021-07-25T19:25:16.172000+00:00",
82-
env
82+
mockEnv
8383
);
8484

8585
expect(global.fetch).toHaveBeenCalledWith(
@@ -88,7 +88,7 @@ describe("verifyCommand", () => {
8888
method: "POST",
8989
headers: {
9090
"Content-Type": "application/json",
91-
Authorization: `Bearer ${env.DISCORD_TOKEN}`,
91+
Authorization: `Bearer ${mockEnv.DISCORD_TOKEN}`,
9292
},
9393
body: JSON.stringify(discordUserData),
9494
}

0 commit comments

Comments
 (0)