Skip to content

Commit 521875a

Browse files
allow string type on android
1 parent f80554e commit 521875a

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

detox/src/android/matcher.js

+4-8
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,14 @@ class LabelMatcher extends Matcher {
6262
class IdMatcher extends Matcher {
6363
constructor(value) {
6464
super();
65-
if (typeof value !== 'string') throw new Error(`IdMatcher ctor argument must be a string, got ${typeof value}`);
66-
this._call = invoke.call(invoke.Android.Class(DetoxMatcher), 'matcherForTestId', value);
65+
this._call = invoke.callDirectly(DetoxMatcherApi.matcherForTestId(value));
6766
}
6867
}
6968

7069
class TypeMatcher extends Matcher {
7170
constructor(value) {
7271
super();
73-
if (typeof value !== 'string') throw new Error(`TypeMatcher ctor argument must be a string, got ${typeof value}`);
74-
this._call = invoke.call(invoke.Android.Class(DetoxMatcher), 'matcherForClass', value);
72+
this._call = invoke.callDirectly(DetoxMatcherApi.matcherForClass(value));
7573
}
7674
}
7775

@@ -106,16 +104,14 @@ class NotExistsMatcher extends Matcher {
106104
class TextMatcher extends Matcher {
107105
constructor(value) {
108106
super();
109-
if (typeof value !== 'string') throw new Error(`TextMatcher ctor argument must be a string, got ${typeof value}`);
110-
this._call = invoke.call(invoke.Android.Class(DetoxMatcher), 'matcherForText', value);
107+
this._call = invoke.callDirectly(DetoxMatcherApi.matcherForText(value));
111108
}
112109
}
113110

114111
class ValueMatcher extends Matcher {
115112
constructor(value) {
116113
super();
117-
if (typeof value !== 'string') throw new Error(`ValueMatcher ctor argument must be a string, got ${typeof value}`);
118-
this._call = invoke.call(invoke.Android.Class(DetoxMatcher), 'matcherForContentDescription', value);
114+
this._call = invoke.callDirectly(DetoxMatcherApi.matcherForContentDescription(value));
119115
}
120116
}
121117

0 commit comments

Comments
 (0)