Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/matchers/element/toHaveAttribute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export async function toHaveAttribute(
options,
})

const result = typeof value !== 'undefined'
const result = value !== undefined
// Name and value is passed in e.g. el.toHaveAttribute('attr', 'value', (opts))
? await toHaveAttributeAndValue.call(this, received, attribute, value, options)
// Only name is passed in e.g. el.toHaveAttribute('attr')
Expand Down
14 changes: 7 additions & 7 deletions src/matchers/mock/toBeRequestedWith.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ export async function toBeRequestedWith(
* is actual method matching an expected method or methods
*/
const methodMatcher = (method: string, expected?: string | Array<string>) => {
if (typeof expected === 'undefined') {
if (expected === undefined) {
return true
}
if (!Array.isArray(expected)) {
Expand All @@ -108,7 +108,7 @@ const methodMatcher = (method: string, expected?: string | Array<string>) => {
* is actual statusCode matching an expected statusCode or statusCodes
*/
const statusCodeMatcher = (statusCode: number, expected?: number | Array<number>) => {
if (typeof expected === 'undefined') {
if (expected === undefined) {
return true
}
if (!Array.isArray(expected)) {
Expand All @@ -124,7 +124,7 @@ const urlMatcher = (
url: string,
expected?: string | ExpectWebdriverIO.PartialMatcher | ((url: string) => boolean)
) => {
if (typeof expected === 'undefined') {
if (expected === undefined) {
return true
}
if (typeof expected === 'function') {
Expand All @@ -148,7 +148,7 @@ const headersMatcher = (
* if header matcher is an empty object, match with no headers
*/
if (
typeof expected === 'undefined' ||
expected === undefined ||
typeof expected === 'object' && Object.keys(expected).length === 0
) {
return true
Expand Down Expand Up @@ -267,7 +267,7 @@ const minifyRequestMock = (
},
requestedWith?: ExpectWebdriverIO.RequestedWith
) => {
if (typeof requestMock === 'undefined') {
if (requestMock === undefined) {
return requestMock
}

Expand Down Expand Up @@ -320,7 +320,7 @@ const requestedWithParamToString = (
| undefined,
transformFn?: (param: ExpectWebdriverIO.JsonCompatible) => ExpectWebdriverIO.JsonCompatible | string
) => {
if (typeof param === 'undefined') {
if (param === undefined) {
return
}

Expand Down Expand Up @@ -394,7 +394,7 @@ const shortenString = (str: string, limit = STR_LIMIT) => {

const deleteUndefinedValues = (obj: Record<string, unknown>, baseline = obj) => {
Object.keys(obj).forEach((k) => {
if (typeof baseline[k] === 'undefined') {
if (baseline[k] === undefined) {
delete obj[k]
}
})
Expand Down