Skip to content

Commit 15b4c00

Browse files
fix: lint and test issues (#609)
1 parent 95ce2ec commit 15b4c00

File tree

5 files changed

+21
-12
lines changed

5 files changed

+21
-12
lines changed

packages/tagscript-plugin-discord/tests/Structures/Structures.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import {
77
GuildMember,
88
GuildMemberFlags,
99
InteractionType,
10+
Locale,
1011
Role,
1112
RoleFlags,
1213
TextChannel,
@@ -43,7 +44,12 @@ const roleObject: APIRole = {
4344
permissions: '8',
4445
managed: false,
4546
mentionable: false,
46-
flags: RoleFlags.InPrompt
47+
flags: RoleFlags.InPrompt,
48+
colors: {
49+
primary_color: 0,
50+
secondary_color: 0,
51+
tertiary_color: 0
52+
}
4753
};
4854

4955
const everyoneRoleObject: APIRole = {
@@ -57,7 +63,12 @@ const everyoneRoleObject: APIRole = {
5763
permissions: '0',
5864
managed: false,
5965
mentionable: false,
60-
flags: RoleFlags.InPrompt
66+
flags: RoleFlags.InPrompt,
67+
colors: {
68+
primary_color: 0,
69+
secondary_color: 0,
70+
tertiary_color: 0
71+
}
6172
};
6273

6374
const guildObject = {
@@ -232,16 +243,15 @@ const interactionObject: APIApplicationCommandInteraction = {
232243
user: userObject,
233244
token: '',
234245
version: 1,
235-
locale: 'en-US',
236-
guild_locale: 'en-US',
246+
locale: Locale.EnglishUS,
247+
guild_locale: Locale.EnglishUS,
237248
entitlements: [],
238249
app_permissions: '8',
239250
channel: channelObject,
240-
authorizing_integration_owners: {}
251+
authorizing_integration_owners: {},
252+
attachment_size_limit: 8_388_608
241253
};
242254

243-
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
244-
245255
// @ts-expect-error(2674) using protected constructor to test
246256
export const user: User = new User(client, userObject);
247257

@@ -262,5 +272,3 @@ export const channel2: TextChannel = new TextChannel(guild, channel2Object, clie
262272

263273
// @ts-expect-error(2674) using protected constructor to test
264274
export const interaction: ChatInputCommandInteraction = new ChatInputCommandInteraction(client, interactionObject);
265-
266-
/* eslint-enable @typescript-eslint/no-unsafe-assignment */

packages/tagscript-plugin-discord/tests/Transformer/User.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ describe('UserTransformer', () => {
1111
expect((await ts.run('{user(username)}', { user: new UserTransformer(user) })).body).toBe('parbez');
1212
expect((await ts.run('{user(a)}', { user: new UserTransformer(user) })).body).toBe('{user(a)}');
1313
expect((await ts.run('{user(b)}', { user: new UserTransformer(user, { b: (user) => user.defaultAvatarURL }) })).body).toBe(
14-
'https://cdn.discordapp.com/embed/avatars/0.png'
14+
'https://cdn.discordapp.com/embed/avatars/3.png'
1515
);
1616
});
1717

packages/tagscript-plugin-discord/tests/Transformer/__snapshots__/GuildMember.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ exports[`MemberTransformer > should match the snapshot 1`] = `
2020
"roleIds": "933378013154906142, 933368398996447292",
2121
"roleNames": "., @everyone",
2222
"roles": "<@&933378013154906142> @everyone",
23-
"tag": "parbez#0000",
23+
"tag": "parbez",
2424
"timeoutUntil": "",
2525
"timeoutUntilTimestamp": null,
2626
"topRole": ".",

packages/tagscript-plugin-discord/tests/Transformer/__snapshots__/User.test.ts.snap

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ exports[`UserTransformer > should match the snapshot 1`] = `
1212
"id": "758880890159235083",
1313
"mention": "<@758880890159235083>",
1414
"name": "",
15-
"tag": "parbez#0000",
15+
"tag": "parbez",
1616
"username": "parbez",
1717
}
1818
`;

packages/tagscript/src/lib/Utils/Util.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const escapeRegex = /(?<!\\)(?<block>[():{|}])/g;
1919
*/
2020
export const asyncFilter = async <T>(values: T[], fn: (t: T) => Awaitable<boolean>) => {
2121
const promises = values.map(fn);
22+
// eslint-disable-next-line @typescript-eslint/await-thenable
2223
const booleans = await Promise.all(promises);
2324
return values.filter((_, index) => booleans[index]);
2425
};

0 commit comments

Comments
 (0)