Skip to content

Commit b848107

Browse files
committed
Remove useless comments
1 parent 922feae commit b848107

1 file changed

Lines changed: 1 addition & 22 deletions

File tree

test/__mocks__/@wdio/globals.ts

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -129,18 +129,6 @@ export function elementArrayFactory(selector: string, length?: number): Webdrive
129129
}
130130
elementArray.parent = browser
131131

132-
// TODO Verify if we need to implement other array methods
133-
// [Symbol.iterator]: array[Symbol.iterator].bind(array)
134-
// filter: vi.fn().mockReturnThis(),
135-
// map: vi.fn().mockReturnThis(),
136-
// find: vi.fn().mockReturnThis(),
137-
// forEach: vi.fn(),
138-
// some: vi.fn(),
139-
// every: vi.fn(),
140-
// slice: vi.fn().mockReturnThis(),
141-
// toArray: vi.fn().mockReturnThis(),
142-
// getElements: vi.fn().mockResolvedValue(array)
143-
144132
return elementArray
145133
}
146134

@@ -154,6 +142,7 @@ export function chainableElementArrayFactory(selector: string, length: number) {
154142
const runtimeChainablePromiseArray = new Proxy(chainablePromiseArray, {
155143
get(target, prop) {
156144
if (typeof prop === 'string' && /^\d+$/.test(prop)) {
145+
// Simulate index out of bounds error when asking for an element outside the array length
157146
const index = parseInt(prop, 10)
158147
if (index >= length) {
159148
const error = new Error(`Index out of bounds! $$(${selector}) returned only ${length} elements.`)
@@ -162,16 +151,6 @@ export function chainableElementArrayFactory(selector: string, length: number) {
162151
if (prop === 'then') {
163152
return (resolve: any, reject: any) => reject(error)
164153
}
165-
// Allow resolving methods like 'catch', 'finally' normally from the promise if needed,
166-
// but usually we want any interaction to fail?
167-
// Actually, standard promise methods might be accessed.
168-
// But the user requirements says: `$$('foo')[3].getText()` should return a promise (that rejects).
169-
170-
// If accessing a property that exists on Promise (like catch, finally, Symbol.toStringTag), maybe we should be careful.
171-
// However, the test expects `el` (the proxy) to be a Promise instance.
172-
// And `el.getText()` to return a promise.
173-
174-
// If I return a function that returns a rejected promise for everything else:
175154
return () => Promise.reject(error)
176155
}
177156
})

0 commit comments

Comments
 (0)