Skip to content

test(structures): add tests for several structures#11407

Draft
AsadHumayun wants to merge 38 commits intodiscordjs:mainfrom
AsadHumayun:feat/add-tests-several-structures
Draft

test(structures): add tests for several structures#11407
AsadHumayun wants to merge 38 commits intodiscordjs:mainfrom
AsadHumayun:feat/add-tests-several-structures

Conversation

@AsadHumayun
Copy link
Contributor

@AsadHumayun AsadHumayun commented Jan 27, 2026

This PR currently adds tests for the following structures:

  • Emoji
  • Entitlement
  • Message/ Embeds
  • Message/ Components
  • Webhook
  • AutoModeration
  • SKU
  • Poll
  • User
  • Stage Instance
  • Team
  • Sticker/StickerPack

I intend on adding tests for more structures also to this PR (to help avoid the number of PRs in review).

Since #11406 will introduce URL getters for several structures, this PR will remain in draft until that is merged so that I can merge and add tests for those methods in one go (to help avoid additional PRs).

I have only added 2 tests for structures so far just so that I can get some initial feedback on the type of approach.

@vercel
Copy link

vercel bot commented Jan 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

2 Skipped Deployments
Project Deployment Actions Updated (UTC)
discord-js Skipped Skipped Mar 8, 2026 9:20pm
discord-js-guide Skipped Skipped Mar 8, 2026 9:20pm

Request Review

@vercel vercel bot temporarily deployed to Preview – discord-js January 27, 2026 21:15 Inactive
@codecov
Copy link

codecov bot commented Jan 27, 2026

Codecov Report

❌ Patch coverage is 78.26087% with 5 lines in your changes missing coverage. Please review.
✅ Project coverage is 37.45%. Comparing base (84b85f4) to head (edaa3ea).

Files with missing lines Patch % Lines
packages/structures/src/voice/VoiceState.ts 81.25% 0 Missing and 3 partials ⚠️
packages/structures/src/skus/SKU.ts 60.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #11407      +/-   ##
==========================================
+ Coverage   31.61%   37.45%   +5.84%     
==========================================
  Files         387      387              
  Lines       13995    14013      +18     
  Branches     1100     1104       +4     
==========================================
+ Hits         4424     5249     +825     
+ Misses       9437     8585     -852     
- Partials      134      179      +45     
Flag Coverage Δ
structures 89.96% <78.26%> (+55.22%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AsadHumayun AsadHumayun force-pushed the feat/add-tests-several-structures branch from 9edce03 to ac342cd Compare January 27, 2026 21:21
@vercel vercel bot temporarily deployed to Preview – discord-js-guide January 27, 2026 21:21 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js January 27, 2026 21:21 Inactive
Copy link
Member

@Qjuh Qjuh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apart from these little nitpicks LGTM

@github-project-automation github-project-automation bot moved this from Todo to Review in Progress in discord.js Jan 28, 2026
@vercel vercel bot temporarily deployed to Preview – discord-js January 29, 2026 19:47 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide January 29, 2026 19:47 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js February 7, 2026 02:29 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 7, 2026 02:29 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 7, 2026 03:01 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js February 7, 2026 03:01 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 8, 2026 18:13 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js February 8, 2026 18:13 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 11, 2026 20:54 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js February 11, 2026 20:54 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js February 11, 2026 23:03 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 11, 2026 23:03 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 11, 2026 23:11 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js February 11, 2026 23:11 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js February 12, 2026 23:32 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 12, 2026 23:32 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js February 16, 2026 21:55 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 27, 2026 19:49 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js February 27, 2026 19:49 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js February 27, 2026 20:01 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 27, 2026 20:01 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js February 27, 2026 20:23 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 27, 2026 20:23 Inactive
AsadHumayun added a commit to AsadHumayun/discord.js that referenced this pull request Feb 27, 2026
When writing tests for discordjs#11407, it became apparent that I had forgotten to add the `toJSON` method for this structure when I was initially wrote the structure. I have now added this method and it passes when running the tests that I have written for this (which will be merged in a following PR).

Signed-off-by: Asad Humayun <asad.humayun@asadh.io>
@vercel vercel bot temporarily deployed to Preview – discord-js February 28, 2026 00:13 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 28, 2026 00:13 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide February 28, 2026 12:59 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js February 28, 2026 12:59 Inactive
kodiakhq bot pushed a commit that referenced this pull request Mar 1, 2026
#11431)

fix(structures): add missing `toJSON` method on Subscription

When writing tests for #11407, it became apparent that I had forgotten to add the `toJSON` method for this structure when I was initially wrote the structure. I have now added this method and it passes when running the tests that I have written for this (which will be merged in a following PR).

Signed-off-by: Asad Humayun <asad.humayun@asadh.io>
@vercel vercel bot temporarily deployed to Preview – discord-js March 3, 2026 18:25 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide March 3, 2026 18:25 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js March 6, 2026 20:07 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide March 6, 2026 20:07 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js March 8, 2026 21:20 Inactive
@vercel vercel bot temporarily deployed to Preview – discord-js-guide March 8, 2026 21:20 Inactive
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: Review in Progress

Development

Successfully merging this pull request may close these issues.

3 participants