Skip to content

Commit 5474538

Browse files
committed
fix(test): remove unused @ts-expect-error directives and fix toEndWith matcher
1 parent 346d286 commit 5474538

File tree

4 files changed

+1
-11
lines changed

4 files changed

+1
-11
lines changed

test/constants/platform.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ describe('constants/platform', () => {
203203
it('should support platform-conditional binary extensions', () => {
204204
const binaryName = WIN32 ? 'app.exe' : 'app'
205205
if (WIN32) {
206-
expect(binaryName).toEndWith('.exe')
206+
expect(binaryName.endsWith('.exe')).toBe(true)
207207
} else {
208208
expect(binaryName).not.toContain('.')
209209
}

test/json.test.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,6 @@ describe('json', () => {
679679
it('should handle array-like objects with non-number first element', () => {
680680
// Tests line 166-171: length > 0 but obj[0] is not a number
681681
expect(() => {
682-
// @ts-expect-error - testing runtime behavior
683682
jsonParse({
684683
length: 1,
685684
0: 'not a number',
@@ -692,7 +691,6 @@ describe('json', () => {
692691
it('should handle objects without proper constructor', () => {
693692
// Tests line 174-177: constructor.isBuffer checks
694693
expect(() => {
695-
// @ts-expect-error - testing runtime behavior
696694
jsonParse({
697695
length: 0,
698696
copy: () => {},
@@ -702,7 +700,6 @@ describe('json', () => {
702700
}).toThrow()
703701

704702
expect(() => {
705-
// @ts-expect-error - testing runtime behavior
706703
jsonParse({
707704
length: 0,
708705
copy: () => {},
@@ -721,7 +718,6 @@ describe('json', () => {
721718
expect(isJsonPrimitive(0)).toBe(true)
722719
expect(isJsonPrimitive(false)).toBe(true)
723720
expect(isJsonPrimitive('')).toBe(true)
724-
// @ts-expect-error - testing runtime behavior
725721
expect(isJsonPrimitive(Number.NaN)).toBe(true) // NaN is a number
726722
})
727723

test/strings.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -618,11 +618,8 @@ describe('strings', () => {
618618
describe('stringWidth edge cases', () => {
619619
it('should return 0 for non-string input', () => {
620620
// Tests line 546-547: typeof check and !text.length
621-
// @ts-expect-error - testing runtime behavior
622621
expect(stringWidth(null)).toBe(0)
623-
// @ts-expect-error - testing runtime behavior
624622
expect(stringWidth(undefined)).toBe(0)
625-
// @ts-expect-error - testing runtime behavior
626623
expect(stringWidth(123)).toBe(0)
627624
})
628625

test/utils/get-ipc.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,6 @@ describe('utils/get-ipc', () => {
166166
const ipc = await getIpc()
167167

168168
expect(() => {
169-
// @ts-expect-error - testing immutability
170169
ipc.SOCKET_CLI_FIX = 'modified'
171170
}).toThrow()
172171
})
@@ -175,7 +174,6 @@ describe('utils/get-ipc', () => {
175174
const ipc = await getIpc()
176175

177176
expect(() => {
178-
// @ts-expect-error - testing immutability
179177
ipc.NEW_PROPERTY = 'value'
180178
}).toThrow()
181179
})
@@ -186,7 +184,6 @@ describe('utils/get-ipc', () => {
186184

187185
if (keys.length > 0) {
188186
expect(() => {
189-
// @ts-expect-error - testing immutability
190187
delete ipc[keys[0]]
191188
}).toThrow()
192189
}

0 commit comments

Comments
 (0)