Skip to content

Commit 7036d5e

Browse files
committed
Remove out of scope TODOs
1 parent 9a13417 commit 7036d5e

5 files changed

Lines changed: 1 addition & 208 deletions

File tree

test-types/jasmine-async/types-jasmine.test.ts

Lines changed: 1 addition & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -263,12 +263,6 @@ describe('type assertions', () => {
263263
expectPromiseVoid = expectAsync(chainableElement).toMatchSnapshot('test label')
264264
expectPromiseVoid = expectAsync(chainableElement).not.toMatchSnapshot('test label')
265265
})
266-
267-
// TODO - since we are overloading the `toMatchSnapshot` of jest.toMatchSnapshot, I wonder if we can achieve the below...
268-
// it('should have ts errors when not an element or chainable', async () => {
269-
// //@ts-expect-error
270-
// await expectAsync('.findme').toMatchSnapshot()
271-
// })
272266
})
273267

274268
describe('toMatchInlineSnapshot', () => {
@@ -390,11 +384,6 @@ describe('type assertions', () => {
390384
const expectString1:string = wdioExpect.toHaveSimpleCustomProperty('string')
391385
const expectString2:string = wdioExpect.not.toHaveSimpleCustomProperty('string')
392386

393-
// TODO how to make the below fails when the await is missing inf front of the expect from the asymmetric matcher?
394-
// expectPromiseVoid = expectAsync(chainableElement).toHaveCustomProperty(
395-
// wdioExpect.toHaveCustomProperty(chainableElement)
396-
// )
397-
398387
// @ts-expect-error
399388
expectVoid = wdioExpect.toHaveSimpleCustomProperty(chainableElement)
400389
// @ts-expect-error
@@ -416,11 +405,6 @@ describe('type assertions', () => {
416405
const expectPromiseWdioElement1: Promise<ExpectWebdriverIO.PartialMatcher<string>> = wdioExpect.toHaveCustomProperty(chainableElement)
417406
const expectPromiseWdioElement2: Promise<ExpectWebdriverIO.PartialMatcher<string>> = wdioExpect.not.toHaveCustomProperty(chainableElement)
418407

419-
// TODO how to make the below fails when the await is missing inf front of the expect from the asymmetric matcher?
420-
// expectPromiseVoid = expectAsync(chainableElement).toHaveCustomProperty(
421-
// wdioExpect.toHaveCustomProperty(chainableElement)
422-
// )
423-
424408
// @ts-expect-error
425409
expectVoid = wdioExpect.toHaveCustomProperty(chainableElement)
426410
// @ts-expect-error
@@ -435,19 +419,6 @@ describe('type assertions', () => {
435419
await wdioExpect.toHaveCustomProperty(chainableElement)
436420
)
437421
})
438-
439-
// TODO this is not supported in Wdio right now, maybe one day we can support it
440-
// it('should support an async asymmetric matcher on a non async matcher', async () => {
441-
// expectPromiseVoid = expectAsync({ value: 5 }).toEqual({
442-
// value: wdioExpect.toHaveCustomProperty(chainableElement)
443-
// })
444-
445-
// // @ts-expect-error
446-
// expectVoid = expectAsync({ value: 5 }).toEqual({
447-
// value: wdioExpect.toHaveCustomProperty(chainableElement)
448-
// })
449-
450-
// })
451422
})
452423
})
453424

@@ -538,11 +509,6 @@ describe('type assertions', () => {
538509
response: { success: true },
539510
})
540511

541-
// TODO dprevost: Asymmetric matcher is not defined on the entire object in the .d.ts file, it is a bug?
542-
// expectPromiseVoid = expectAsync(promiseNetworkMock).toBeRequestedWith(wdioExpect.objectContaining({
543-
// response: { success: true }, // [optional] object | function | custom matcher
544-
// }))
545-
546512
expectPromiseVoid = expectAsync(promiseNetworkMock).toBeRequestedWith({
547513
url: wdioExpect.stringContaining('test'),
548514
method: 'POST',
@@ -713,13 +679,6 @@ describe('type assertions', () => {
713679
// @ts-expect-error
714680
expectVoid = wdioExpect.soft(chainableArray).not.toBeDisplayed()
715681
})
716-
717-
it('should have ts (or lint) errors when actual is a chainable not awaited', async () => {
718-
// TODO dprevost: see if an eslint rule could help us here to detect missing await when not using wdio matchers
719-
// expectPromiseVoid = wdioExpect.soft(chainableElement.getText()).toEqual('Basketball Shoes')
720-
// expectPromiseVoid = wdioExpect.soft(chainableElement.getText()).toMatch(/€\d+/)
721-
})
722-
723682
it('should work with custom matcher and custom asymmetric matchers from `expect` module', async () => {
724683
expectPromiseVoid = wdioExpect.soft(chainableElement).toHaveCustomProperty('text')
725684
expectPromiseVoid = wdioExpect.soft(chainableElement).toHaveCustomProperty(wdioExpect.stringContaining('text'))
@@ -862,7 +821,7 @@ describe('type assertions', () => {
862821
expectVoid = expectAsync(Promise.resolve('test')).toBeResolved()
863822
})
864823
it('jasmine special asymmetric matcher', async () => {
865-
// TODO dprevost: Is this valid since expect is from WebdriverIO and we force it to be `expectAsync` in the main project?
824+
// Note: Even though the below is valid syntax, jasmine prefix for asymmetric matchers is not supported by wdioExpect.
866825
expectAsync({}).toEqual(jasmine.any(Object))
867826
expectAsync(12).toEqual(jasmine.any(Number))
868827
})

test-types/jasmine/types-jasmine.test.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ describe('type assertions', () => {
3838

3939
// @ts-expect-error
4040
await wdioExpect(browser).toHaveUrl(6)
41-
//// @ts-expect-error TODO dprevost can we make the below fail?
42-
// await wdioExpect(browser).toHaveUrl(wdioExpect.objectContaining({}))
4341
})
4442

4543
it('should have ts errors when actual is not a Browser element', async () => {
@@ -272,12 +270,6 @@ describe('type assertions', () => {
272270
//@ts-expect-error
273271
expectVoid = wdioExpect(chainableElement).not.toMatchSnapshot()
274272
})
275-
276-
// TODO - since we are overloading the `toMatchSnapshot` of jest.toMatchSnapshot, I wonder if we can achieve the below...
277-
// it('should have ts errors when not an element or chainable', async () => {
278-
// //@ts-expect-error
279-
// await wdioExpect('.findme').toMatchSnapshot()
280-
// })
281273
})
282274

283275
describe('toMatchInlineSnapshot', () => {
@@ -413,11 +405,6 @@ describe('type assertions', () => {
413405
const expectString1:string = wdioExpect.toHaveSimpleCustomProperty('string')
414406
const expectString2:string = wdioExpect.not.toHaveSimpleCustomProperty('string')
415407

416-
// TODO how to make the below fails when the await is missing inf front of the expect from the asymmetric matcher?
417-
// expectPromiseVoid = wdioExpect(chainableElement).toHaveCustomProperty(
418-
// wdioExpect.toHaveCustomProperty(chainableElement)
419-
// )
420-
421408
// @ts-expect-error
422409
expectVoid = wdioExpect.toHaveSimpleCustomProperty(chainableElement)
423410
// @ts-expect-error
@@ -439,11 +426,6 @@ describe('type assertions', () => {
439426
const expectPromiseWdioElement1: Promise<ExpectWebdriverIO.PartialMatcher<string>> = wdioExpect.toHaveCustomProperty(chainableElement)
440427
const expectPromiseWdioElement2: Promise<ExpectWebdriverIO.PartialMatcher<string>> = wdioExpect.not.toHaveCustomProperty(chainableElement)
441428

442-
// TODO how to make the below fails when the await is missing inf front of the expect from the asymmetric matcher?
443-
// expectPromiseVoid = wdioExpect(chainableElement).toHaveCustomProperty(
444-
// wdioExpect.toHaveCustomProperty(chainableElement)
445-
// )
446-
447429
// @ts-expect-error
448430
expectVoid = wdioExpect.toHaveCustomProperty(chainableElement)
449431
// @ts-expect-error
@@ -458,19 +440,6 @@ describe('type assertions', () => {
458440
await wdioExpect.toHaveCustomProperty(chainableElement)
459441
)
460442
})
461-
462-
// TODO this is not supported in Wdio right now, maybe one day we can support it
463-
// it('should support an async asymmetric matcher on a non async matcher', async () => {
464-
// expectPromiseVoid = wdioExpect({ value: 5 }).toEqual({
465-
// value: wdioExpect.toHaveCustomProperty(chainableElement)
466-
// })
467-
468-
// // @ts-expect-error
469-
// expectVoid = wdioExpect({ value: 5 }).toEqual({
470-
// value: wdioExpect.toHaveCustomProperty(chainableElement)
471-
// })
472-
473-
// })
474443
})
475444
})
476445

@@ -575,11 +544,6 @@ describe('type assertions', () => {
575544
response: { success: true },
576545
})
577546

578-
// TODO dprevost: Asymmetric matcher is not defined on the entire object in the .d.ts file, it is a bug?
579-
// expectPromiseVoid = wdioExpect(promiseNetworkMock).toBeRequestedWith(wdioExpect.objectContaining({
580-
// response: { success: true }, // [optional] object | function | custom matcher
581-
// }))
582-
583547
expectPromiseVoid = wdioExpect(promiseNetworkMock).toBeRequestedWith({
584548
url: wdioExpect.stringContaining('test'),
585549
method: 'POST',
@@ -751,12 +715,6 @@ describe('type assertions', () => {
751715
expectVoid = wdioExpect.soft(chainableArray).not.toBeDisplayed()
752716
})
753717

754-
it('should have ts (or lint) errors when actual is a chainable not awaited', async () => {
755-
// TODO dprevost: see if an eslint rule could help us here to detect missing await when not using wdio matchers
756-
// expectPromiseVoid = wdioExpect.soft(chainableElement.getText()).toEqual('Basketball Shoes')
757-
// expectPromiseVoid = wdioExpect.soft(chainableElement.getText()).toMatch(/€\d+/)
758-
})
759-
760718
it('should work with custom matcher and custom asymmetric matchers from `expect` module', async () => {
761719
expectPromiseVoid = wdioExpect.soft(chainableElement).toHaveCustomProperty('text')
762720
expectPromiseVoid = wdioExpect.soft(chainableElement).toHaveCustomProperty(wdioExpect.stringContaining('text'))

test-types/jest-@jest_global/types-jest.test.ts

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,6 @@ import { expect } from 'expect-webdriverio'
44
import { describe, it, expect as jestExpect } from '@jest/globals'
55

66
describe('type assertions', async () => {
7-
// TODO dprevost: using @wdio/globals/types overlap with the local types/expect-webdriverio.d.ts, find how to work with this
8-
// const chainableElement: ChainablePromiseElement = $('findMe')
9-
// const chainableArray: ChainablePromiseArray = $$('ul>li')
10-
11-
// const element: WebdriverIO.Element = await chainableElement?.getElement()
12-
// const elementArray: WebdriverIO.ElementArray = await chainableArray?.getElements()
13-
147
const chainableElement = {} as unknown as ChainablePromiseElement
158
const chainableArray = {} as ChainablePromiseArray
169

@@ -278,12 +271,6 @@ describe('type assertions', async () => {
278271
//@ts-expect-error
279272
expectVoid = expect(chainableElement).not.toMatchSnapshot()
280273
})
281-
282-
// TODO - since we are overloading the `toMatchSnapshot` of jest.toMatchSnapshot, I wonder if we can achieve the below...
283-
// it('should have ts errors when not an element or chainable', async () => {
284-
// //@ts-expect-error
285-
// await expect('.findme').toMatchSnapshot()
286-
// })
287274
})
288275

289276
describe('toMatchInlineSnapshot', () => {
@@ -419,11 +406,6 @@ describe('type assertions', async () => {
419406
const expectString1:string = expect.toHaveSimpleCustomProperty('string')
420407
const expectString2:string = expect.not.toHaveSimpleCustomProperty('string')
421408

422-
// TODO how to make the below fails when the await is missing inf front of the expect from the asymmetric matcher?
423-
// expectPromiseVoid = expect(chainableElement).toHaveCustomProperty(
424-
// expect.toHaveCustomProperty(chainableElement)
425-
// )
426-
427409
// @ts-expect-error
428410
expectVoid = expect.toHaveSimpleCustomProperty(chainableElement)
429411
// @ts-expect-error
@@ -445,11 +427,6 @@ describe('type assertions', async () => {
445427
const expectPromiseWdioElement1: Promise<ExpectWebdriverIO.PartialMatcher<string>> = expect.toHaveCustomProperty(chainableElement)
446428
const expectPromiseWdioElement2: Promise<ExpectWebdriverIO.PartialMatcher<string>> = expect.not.toHaveCustomProperty(chainableElement)
447429

448-
// TODO how to make the below fails when the await is missing inf front of the expect from the asymmetric matcher?
449-
// expectPromiseVoid = expect(chainableElement).toHaveCustomProperty(
450-
// expect.toHaveCustomProperty(chainableElement)
451-
// )
452-
453430
// @ts-expect-error
454431
expectVoid = expect.toHaveCustomProperty(chainableElement)
455432
// @ts-expect-error
@@ -464,19 +441,6 @@ describe('type assertions', async () => {
464441
await expect.toHaveCustomProperty(chainableElement)
465442
)
466443
})
467-
468-
// TODO this is not supported in Wdio right now, maybe one day we can support it
469-
// it('should support an async asymmetric matcher on a non async matcher', async () => {
470-
// expectPromiseVoid = expect({ value: 5 }).toEqual({
471-
// value: expect.toHaveCustomProperty(chainableElement)
472-
// })
473-
474-
// // @ts-expect-error
475-
// expectVoid = expect({ value: 5 }).toEqual({
476-
// value: expect.toHaveCustomProperty(chainableElement)
477-
// })
478-
479-
// })
480444
})
481445
})
482446

@@ -757,12 +721,6 @@ describe('type assertions', async () => {
757721
expectVoid = expect.soft(chainableArray).not.toBeDisplayed()
758722
})
759723

760-
it('should have ts (or lint) errors when actual is a chainable not awaited', async () => {
761-
// TODO dprevost: see if an eslint rule could help us here to detect missing await when not using wdio matchers
762-
// expectPromiseVoid = expect.soft(chainableElement.getText()).toEqual('Basketball Shoes')
763-
// expectPromiseVoid = expect.soft(chainableElement.getText()).toMatch(/€\d+/)
764-
})
765-
766724
it('should work with custom matcher and custom asymmetric matchers from `expect` module', async () => {
767725
expectPromiseVoid = expect.soft(chainableElement).toHaveCustomProperty('text')
768726
expectPromiseVoid = expect.soft(chainableElement).toHaveCustomProperty(expect.stringContaining('text'))

test-types/jest-@types_jest/types-jest.test.ts

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
11
/* eslint-disable @typescript-eslint/no-unused-vars */
22

33
describe('type assertions', async () => {
4-
// TODO dprevost: using @wdio/globals/types overlap with the local types/expect-webdriverio.d.ts, find how to work with this
5-
// const chainableElement: ChainablePromiseElement = $('findMe')
6-
// const chainableArray: ChainablePromiseArray = $$('ul>li')
7-
8-
// const element: WebdriverIO.Element = await chainableElement?.getElement()
9-
// const elementArray: WebdriverIO.ElementArray = await chainableArray?.getElements()
10-
114
const chainableElement = {} as unknown as ChainablePromiseElement
125
const chainableArray = {} as ChainablePromiseArray
136

@@ -275,12 +268,6 @@ describe('type assertions', async () => {
275268
//@ts-expect-error
276269
expectVoid = expect(chainableElement).not.toMatchSnapshot()
277270
})
278-
279-
// TODO - since we are overloading the `toMatchSnapshot` of jest.toMatchSnapshot, I wonder if we can achieve the below...
280-
// it('should have ts errors when not an element or chainable', async () => {
281-
// //@ts-expect-error
282-
// await expect('.findme').toMatchSnapshot()
283-
// })
284271
})
285272

286273
describe('toMatchInlineSnapshot', () => {
@@ -416,11 +403,6 @@ describe('type assertions', async () => {
416403
const expectString1:string = expect.toHaveSimpleCustomProperty('string')
417404
const expectString2:string = expect.not.toHaveSimpleCustomProperty('string')
418405

419-
// TODO how to make the below fails when the await is missing inf front of the expect from the asymmetric matcher?
420-
// expectPromiseVoid = expect(chainableElement).toHaveCustomProperty(
421-
// expect.toHaveCustomProperty(chainableElement)
422-
// )
423-
424406
// @ts-expect-error
425407
expectVoid = expect.toHaveSimpleCustomProperty(chainableElement)
426408
// @ts-expect-error
@@ -442,11 +424,6 @@ describe('type assertions', async () => {
442424
const expectPromiseWdioElement1: Promise<ExpectWebdriverIO.PartialMatcher<string>> = expect.toHaveCustomProperty(chainableElement)
443425
const expectPromiseWdioElement2: Promise<ExpectWebdriverIO.PartialMatcher<string>> = expect.not.toHaveCustomProperty(chainableElement)
444426

445-
// TODO how to make the below fails when the await is missing inf front of the expect from the asymmetric matcher?
446-
// expectPromiseVoid = expect(chainableElement).toHaveCustomProperty(
447-
// expect.toHaveCustomProperty(chainableElement)
448-
// )
449-
450427
// @ts-expect-error
451428
expectVoid = expect.toHaveCustomProperty(chainableElement)
452429
// @ts-expect-error
@@ -461,19 +438,6 @@ describe('type assertions', async () => {
461438
await expect.toHaveCustomProperty(chainableElement)
462439
)
463440
})
464-
465-
// TODO this is not supported in Wdio right now, maybe one day we can support it
466-
// it('should support an async asymmetric matcher on a non async matcher', async () => {
467-
// expectPromiseVoid = expect({ value: 5 }).toEqual({
468-
// value: expect.toHaveCustomProperty(chainableElement)
469-
// })
470-
471-
// // @ts-expect-error
472-
// expectVoid = expect({ value: 5 }).toEqual({
473-
// value: expect.toHaveCustomProperty(chainableElement)
474-
// })
475-
476-
// })
477441
})
478442
})
479443

@@ -583,11 +547,6 @@ describe('type assertions', async () => {
583547
response: { success: true },
584548
})
585549

586-
// TODO dprevost: Asymmetric matcher is not defined on the entire object in the .d.ts file, it is a bug?
587-
// expectPromiseVoid = expect(promiseNetworkMock).toBeRequestedWith(expect.objectContaining({
588-
// response: { success: true }, // [optional] object | function | custom matcher
589-
// }))
590-
591550
expectPromiseVoid = expect(promiseNetworkMock).toBeRequestedWith({
592551
url: expect.stringContaining('test'),
593552
method: 'POST',
@@ -757,12 +716,6 @@ describe('type assertions', async () => {
757716
expectVoid = expect.soft(chainableArray).not.toBeDisplayed()
758717
})
759718

760-
it('should have ts (or lint) errors when actual is a chainable not awaited', async () => {
761-
// TODO dprevost: see if an eslint rule could help us here to detect missing await when not using wdio matchers
762-
// expectPromiseVoid = expect.soft(chainableElement.getText()).toEqual('Basketball Shoes')
763-
// expectPromiseVoid = expect.soft(chainableElement.getText()).toMatch(/€\d+/)
764-
})
765-
766719
it('should work with custom matcher and custom asymmetric matchers from `expect` module', async () => {
767720
expectPromiseVoid = expect.soft(chainableElement).toHaveCustomProperty('text')
768721
expectPromiseVoid = expect.soft(chainableElement).toHaveCustomProperty(expect.stringContaining('text'))

0 commit comments

Comments
 (0)