WIP: Migrate to yarn
Some checks failed
Test / build (push) Failing after 16s

This commit is contained in:
Ethan Lane 2024-06-27 18:31:59 +01:00
parent 16bc43c30e
commit 739bd0713d
7 changed files with 4720 additions and 8866 deletions

View file

@ -17,9 +17,9 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- run: npm run build
- run: npm test
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test
- name: "Copy files over to location"
run: cp -r . ${{ secrets.PROD_REPO_PATH }}
@ -63,5 +63,5 @@ jobs:
&& (pm2 delete vylbot_prod || true) \
&& docker compose up -d \
&& sleep 10 \
&& npm run db:up \
&& pm2 start --name vylbot_prod dist/vylbot.js
&& yarn db:up \
&& pm2 start --name vylbot_prod dist/vylbot.js

View file

@ -17,9 +17,9 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- run: npm run build
- run: npm test
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test
- name: "Copy files over to location"
run: cp -r . ${{ secrets.STAGE_REPO_PATH }}
@ -63,5 +63,5 @@ jobs:
&& (pm2 delete vylbot_stage || true) \
&& docker compose up -d \
&& sleep 10 \
&& npm run db:up \
&& pm2 start --name vylbot_stage dist/vylbot.js
&& yarn db:up \
&& pm2 start --name vylbot_stage dist/vylbot.js

View file

@ -19,6 +19,6 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: 18.x
- run: npm ci
- run: npm run build
- run: npm test
- run: yarn install --frozen-lockfile
- run: yarn build
- run: yarn test

8826
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -92,7 +92,7 @@ export default class Audits extends Command {
private async SendAuditForUser(interaction: CommandInteraction) {
if (!interaction.guildId) return;
const user = interaction.options.getUser('target');
const user = interaction.options.get('target', true).user!;
if (!user) {
await interaction.reply("User not found.");
@ -190,7 +190,7 @@ export default class Audits extends Command {
private async AddAudit(interaction: CommandInteraction) {
if (!interaction.guildId) return;
const user = interaction.options.getUser('target');
const user = interaction.options.get('target', true).user!;
const auditType = interaction.options.get('type');
const reasonInput = interaction.options.get('reason');
@ -208,4 +208,4 @@ export default class Audits extends Command {
await interaction.reply(`Created new audit with ID \`${audit.AuditId}\``);
}
}
}

View file

@ -130,7 +130,9 @@ describe("user", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("user"),
getUser: jest.fn().mockReturnValue(user),
get: jest.fn().mockReturnValue({
user: user
}),
},
guildId: "guildId",
reply: jest.fn().mockImplementation((options) => {
@ -150,8 +152,8 @@ describe("user", () => {
expect(AuditTools.TypeToFriendlyText).toHaveBeenCalledTimes(1);
expect(AuditTools.TypeToFriendlyText).toHaveBeenCalledWith(AuditType.Warn);
expect(interaction.options.getUser).toHaveBeenCalledTimes(1);
expect(interaction.options.getUser).toHaveBeenCalledWith("target");
expect(interaction.options.get).toHaveBeenCalledTimes(1);
expect(interaction.options.get).toHaveBeenCalledWith("target", true);
expect(interaction.reply).toHaveBeenCalledTimes(1);
expect(repliedWith).toBeDefined();
@ -193,7 +195,9 @@ describe("user", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("user"),
getUser: jest.fn().mockReturnValue(null),
get: jest.fn().mockReturnValue({
user: null
}),
},
guildId: "guildId",
reply: jest.fn(),
@ -202,7 +206,7 @@ describe("user", () => {
const audits = new Audits();
await audits.execute(interaction);
expect(interaction.options.getUser).toHaveBeenCalledTimes(1);
expect(interaction.options.get).toHaveBeenCalledTimes(1);
expect(interaction.reply).toHaveBeenCalledTimes(1);
expect(interaction.reply).toHaveBeenCalledWith("User not found.");
@ -213,7 +217,9 @@ describe("user", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("user"),
getUser: jest.fn().mockReturnValue({}),
get: jest.fn().mockReturnValue({
user: {},
}),
},
guildId: "guildId",
reply: jest.fn(),
@ -226,7 +232,7 @@ describe("user", () => {
expect(Audit.FetchAuditsByUserId).toHaveBeenCalledTimes(1);
expect(interaction.options.getUser).toHaveBeenCalledTimes(1);
expect(interaction.options.get).toHaveBeenCalledTimes(1);
expect(interaction.reply).toHaveBeenCalledTimes(1);
expect(interaction.reply).toHaveBeenCalledWith("There are no audits for this user.");
@ -237,7 +243,9 @@ describe("user", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("user"),
getUser: jest.fn().mockReturnValue({}),
get: jest.fn().mockReturnValue({
user: {},
}),
},
guildId: "guildId",
reply: jest.fn(),
@ -250,7 +258,7 @@ describe("user", () => {
expect(Audit.FetchAuditsByUserId).toHaveBeenCalledTimes(1);
expect(interaction.options.getUser).toHaveBeenCalledTimes(1);
expect(interaction.options.get).toHaveBeenCalledTimes(1);
expect(interaction.reply).toHaveBeenCalledTimes(1);
expect(interaction.reply).toHaveBeenCalledWith("There are no audits for this user.");
@ -593,8 +601,9 @@ describe("add", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("add"),
getUser: jest.fn().mockReturnValue(user),
get: jest.fn().mockReturnValueOnce(type)
get: jest.fn()
.mockReturnValueOnce({ user })
.mockReturnValueOnce(type)
.mockReturnValue(reason),
},
user: {
@ -637,8 +646,9 @@ describe("add", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("add"),
getUser: jest.fn().mockReturnValue(null),
get: jest.fn().mockReturnValue({}),
get: jest.fn()
.mockReturnValueOnce({ user: null })
.mockReturnValue({}),
},
reply: jest.fn(),
} as unknown as CommandInteraction;
@ -656,8 +666,9 @@ describe("add", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("add"),
getUser: jest.fn().mockReturnValue(null),
get: jest.fn().mockReturnValueOnce(null)
get: jest.fn()
.mockReturnValueOnce({ user: null })
.mockReturnValueOnce(null)
.mockReturnValue({}),
},
reply: jest.fn(),
@ -676,10 +687,11 @@ describe("add", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("add"),
getUser: jest.fn().mockReturnValue(null),
get: jest.fn().mockReturnValueOnce({
value: undefined
})
get: jest.fn()
.mockReturnValueOnce({ user: null })
.mockReturnValueOnce({
value: undefined
})
.mockReturnValue({}),
},
reply: jest.fn(),
@ -708,8 +720,9 @@ describe("add", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("add"),
getUser: jest.fn().mockReturnValue(user),
get: jest.fn().mockReturnValueOnce(type)
get: jest.fn()
.mockReturnValueOnce({ user })
.mockReturnValueOnce(type)
.mockReturnValue(null),
},
user: {
@ -752,8 +765,9 @@ describe("add", () => {
isChatInputCommand: jest.fn().mockReturnValue(true),
options: {
getSubcommand: jest.fn().mockReturnValue("add"),
getUser: jest.fn().mockReturnValue(user),
get: jest.fn().mockReturnValueOnce(type)
get: jest.fn()
.mockReturnValueOnce({ user })
.mockReturnValueOnce(type)
.mockReturnValue(reason),
},
user: {
@ -775,4 +789,4 @@ describe("add", () => {
expect(savedAudit).toBeDefined();
expect(savedAudit!.Reason).toBe("");
});
});
});

4666
yarn.lock Normal file

File diff suppressed because it is too large Load diff