Skip to content

Commit b909480

Browse files
lusarzeddyerburgh
authored andcommitted
refactor: refactor getSelectorTypeOrThrow method (#515)
1 parent 75af227 commit b909480

File tree

1 file changed

+6
-23
lines changed

1 file changed

+6
-23
lines changed

packages/test-utils/src/get-selector-type.js

Lines changed: 6 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -16,28 +16,11 @@ import {
1616
DOM_SELECTOR
1717
} from './consts'
1818

19-
function getSelectorType (selector: Selector): string | void {
20-
if (isDomSelector(selector)) {
21-
return DOM_SELECTOR
22-
}
23-
24-
if (isNameSelector(selector)) {
25-
return NAME_SELECTOR
26-
}
27-
28-
if (isVueComponent(selector)) {
29-
return COMPONENT_SELECTOR
30-
}
31-
32-
if (isRefSelector(selector)) {
33-
return REF_SELECTOR
34-
}
35-
}
36-
3719
export default function getSelectorTypeOrThrow (selector: Selector, methodName: string): string | void {
38-
const selectorType = getSelectorType(selector)
39-
if (!selectorType) {
40-
throwError(`wrapper.${methodName}() must be passed a valid CSS selector, Vue constructor, or valid find option object`)
41-
}
42-
return selectorType
20+
if (isDomSelector(selector)) return DOM_SELECTOR
21+
if (isNameSelector(selector)) return NAME_SELECTOR
22+
if (isVueComponent(selector)) return COMPONENT_SELECTOR
23+
if (isRefSelector(selector)) return REF_SELECTOR
24+
25+
throwError(`wrapper.${methodName}() must be passed a valid CSS selector, Vue constructor, or valid find option object`)
4326
}

0 commit comments

Comments
 (0)