discord.js
discord.js copied to clipboard
feat(builders): Allow passing `null` to optional setters
Please describe the changes this PR makes and why it should be merged:
Adds support for passing null
to setters that set optional values to easily reset them, like Embed
already does. Resolves #8350.
I did not add support for undefined
to be consistent with Embed
Status and versioning classification:
- Code changes have been tested against the Discord API, or there are no code changes
- I know how to update typings and have done so, or typings don't need updating
The latest updates on your projects. Learn more about Vercel for Git ↗︎
Name | Status | Preview | Updated |
---|---|---|---|
discord-js | ✅ Ready (Inspect) | Visit Preview | Oct 19, 2022 at 1:57PM (UTC) |
discord-js-guide | ✅ Ready (Inspect) | Visit Preview | Oct 19, 2022 at 1:57PM (UTC) |
Tests are not passing: https://github.com/discordjs/discord.js/runs/8160731228?check_suite_focus=true#step:7:246
@discordjs/builders:test: ⎯⎯⎯⎯⎯⎯⎯ Failed Tests 1 ⎯⎯⎯⎯⎯⎯⎯
@discordjs/builders:test:
@discordjs/builders:test: FAIL __tests__/components/button.test.ts > Button Components > Assertion Tests > GIVEN invalid label THEN validator does throw
@discordjs/builders:test: AssertionError: expected [Function] to throw an error
@discordjs/builders:test: ❯ __tests__/components/button.test.ts:23:50
@discordjs/builders:test: 21|
@discordjs/builders:test: 22| test('GIVEN invalid label THEN validator does throw', () => {
@discordjs/builders:test: 23| expect(() => buttonLabelValidator.parse(null)).toThrowError();
@discordjs/builders:test: | ^
@discordjs/builders:test: 24| expect(() => buttonLabelValidator.parse('')).toThrowError();
@discordjs/builders:test: 25|
@discordjs/builders:test:
@discordjs/builders:test: ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯[1/1]⎯
@discordjs/builders:test:
@discordjs/builders:test: Test Files 1 failed | 11 passed (12)
@discordjs/builders:test: Tests 1 failed | 221 passed (222)
I removed the failing test because null
is not an invalid value. The Discord API allows passing an emoji and no label on a button, so labels can be null
.
read my suggestion again. move the test under GIVEN valid label THEN validator does not throw
section.
Codecov Report
Merging #8559 (0671c89) into main (bf9aa18) will decrease coverage by
0.16%
. The diff coverage is73.43%
.
@@ Coverage Diff @@
## main #8559 +/- ##
==========================================
- Coverage 85.81% 85.64% -0.17%
==========================================
Files 91 91
Lines 9254 9263 +9
Branches 1125 1143 +18
==========================================
- Hits 7941 7933 -8
- Misses 1271 1288 +17
Partials 42 42
Flag | Coverage Δ | |
---|---|---|
brokers | 65.24% <ø> (ø) |
|
builders | 99.46% <73.43%> (-0.54%) |
:arrow_down: |
collection | 100.00% <ø> (ø) |
|
proxy | 81.53% <ø> (ø) |
|
rest | 92.06% <ø> (ø) |
|
util | 100.00% <ø> (ø) |
|
utilities | 100.00% <ø> (ø) |
|
voice | 63.70% <ø> (ø) |
|
ws | 59.83% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
Impacted Files | Coverage Δ | |
---|---|---|
packages/builders/src/components/button/Button.ts | 98.54% <50.00%> (-1.46%) |
:arrow_down: |
...s/builders/src/components/selectMenu/SelectMenu.ts | 98.15% <50.00%> (-1.85%) |
:arrow_down: |
...ges/builders/src/components/textInput/TextInput.ts | 97.31% <50.00%> (-2.69%) |
:arrow_down: |
...s/src/interactions/slashCommands/options/number.ts | 96.15% <50.00%> (-3.85%) |
:arrow_down: |
...s/src/interactions/slashCommands/options/string.ts | 96.36% <50.00%> (-3.64%) |
:arrow_down: |
.../src/interactions/slashCommands/options/integer.ts | 96.15% <60.00%> (-3.85%) |
:arrow_down: |
...ders/src/components/selectMenu/SelectMenuOption.ts | 97.97% <75.00%> (-2.03%) |
:arrow_down: |
packages/builders/src/components/Assertions.ts | 100.00% <100.00%> (ø) |
|
...es/builders/src/components/textInput/Assertions.ts | 100.00% <100.00%> (ø) |
|
...ApplicationCommandNumericOptionMinMaxValueMixin.ts | 100.00% <100.00%> (ø) |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
What else can I do to get this merged?
@RedGuy12 is attempting to deploy a commit to the discordjs Team on Vercel.
A member of the Team first needs to authorize it.
I don't think this is stilll blocked...