Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit19253f6

Browse files
QjuhJiralite
andauthored
feat: message structures (#10982)
* feat: message structures* fix: docs* chore: components and more* feat: embed and more* feat: more substructures and code review suggestions* chore: tests and date conversions* chore: jsdoc strings* fix: tests* fix: tests* feat: hexColor getters* chore: remove getters for nested data* chore: apply suggestions from code review* fix: burst_colors in toJSON* docs: rephrase SectionBuilder remark* chore: add LabelComponent* fix: add name and size to file component* chore: move resolved interaction data to interactions dir* fix: code review* chore: bump discord-api-types* chore: apply code review suggestions* fix: lockfile* chore: update remark* fix: missing export* chore: code review and tests* build: fix file* fix: typo* fix: missing toJSON* fix: remove redundant patch overrides* chore: missing component suffix* chore: better name* chore: add comment explaining timestamp conversion---------Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
1 parentaeb8986 commit19253f6

File tree

79 files changed

+3281
-93
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+3281
-93
lines changed

‎packages/structures/__tests__/channels.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import {
3838
TextChannel,
3939
ThreadMetadata,
4040
VoiceChannel,
41-
}from'../src/index.js';
41+
}from'../src/channels/index.js';
4242
import{kData}from'../src/utils/symbols.js';
4343

4444
describe('text channel',()=>{

‎packages/structures/__tests__/invite.test.ts‎

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
importtype{APIExtendedInvite,APIInvite}from'discord-api-types/v10';
22
import{InviteTargetType,InviteType}from'discord-api-types/v10';
33
import{describe,expect,test}from'vitest';
4-
import{Invite}from'../src/index.js';
4+
import{Invite}from'../src/invites/Invite.js';
5+
import{dateToDiscordISOTimestamp}from'../src/utils/optimization.js';
56
import{kPatch}from'../src/utils/symbols.js';
67

78
describe('Invite',()=>{
@@ -22,7 +23,7 @@ describe('Invite', () => {
2223

2324
constdataExtended:Omit<APIExtendedInvite,'expires_at'>={
2425
...data,
25-
created_at:'2020-10-10T13:50:17.209Z',
26+
created_at:'2020-10-10T13:50:17.209000+00:00',
2627
max_age:12,
2728
max_uses:34,
2829
temporary:false,
@@ -54,7 +55,7 @@ describe('Invite', () => {
5455
constinstance=newInvite(dataExtended);
5556
expect(instance.type).toBe(data.type);
5657
expect(instance.code).toBe(dataExtended.code);
57-
expect(instance.createdAt?.toISOString()).toBe(dataExtended.created_at);
58+
expect(dateToDiscordISOTimestamp(instance.createdAt!)).toBe(dataExtended.created_at);
5859
expect(instance.createdTimestamp).toBe(Date.parse(dataExtended.created_at));
5960
expect(instance.maxAge).toBe(dataExtended.max_age);
6061
expect(instance.maxUses).toBe(dataExtended.max_uses);
@@ -63,10 +64,10 @@ describe('Invite', () => {
6364
expect(instance.targetType).toBe(dataExtended.target_type);
6465
expect(instance.temporary).toBe(dataExtended.temporary);
6566
expect(instance.uses).toBe(dataExtended.uses);
66-
expect(instance.expiresTimestamp).toStrictEqual(Date.parse('2020-10-10T13:50:29.209Z'));
67-
expect(instance.expiresAt).toStrictEqual(newDate('2020-10-10T13:50:29.209Z'));
67+
expect(instance.expiresTimestamp).toStrictEqual(Date.parse('2020-10-10T13:50:29.209000+00:00'));
68+
expect(instance.expiresAt).toStrictEqual(newDate('2020-10-10T13:50:29.209000+00:00'));
6869
expect(instance.url).toBe('https://discord.gg/123');
69-
expect(instance.toJSON()).toEqual({ ...dataExtended,expires_at:'2020-10-10T13:50:29.209Z'});
70+
expect(instance.toJSON()).toEqual({ ...dataExtended,expires_at:'2020-10-10T13:50:29.209000+00:00'});
7071
});
7172

7273
test('Invite with omitted properties',()=>{
@@ -79,8 +80,8 @@ describe('Invite', () => {
7980
});
8081

8182
test('Invite with expiration',()=>{
82-
constinstance=newInvite({ ...dataExtended,expires_at:'2020-10-10T13:50:29.209Z'});
83-
expect(instance.toJSON()).toEqual({ ...dataExtended,expires_at:'2020-10-10T13:50:29.209Z'});
83+
constinstance=newInvite({ ...dataExtended,expires_at:'2020-10-10T13:50:29.209000+00:00'});
84+
expect(instance.toJSON()).toEqual({ ...dataExtended,expires_at:'2020-10-10T13:50:29.209000+00:00'});
8485
});
8586

8687
test('Patching Invite works in place',()=>{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp