Skip to content

Commit a0fd520

Browse files
committed
Do not use inner function
1 parent 392d9c6 commit a0fd520

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

packages/native/src/lib/ElementAssertion.ts

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -142,29 +142,26 @@ export class ElementAssertion extends Assertion<ReactTestInstance> {
142142
message: `Expected element ${this.toString()} NOT to contain element ${instanceToString(element)}.`,
143143
});
144144

145-
const isElementContained = (
146-
parentElement: ReactTestInstance,
147-
childElement: ReactTestInstance,
148-
): boolean => {
149-
if (parentElement === null || childElement === null) {
150-
return false;
151-
}
152-
153-
return (
154-
parentElement.findAll(
155-
node =>
156-
node.type === childElement.type && node.props === childElement.props,
157-
).length > 0
158-
);
159-
};
160-
161145
return this.execute({
162-
assertWhen: isElementContained(this.actual, element),
146+
assertWhen: this.isElementContained(this.actual, element),
163147
error,
164148
invertedError,
165149
});
166150
}
167151

152+
private isElementContained(parentElement: ReactTestInstance, childElement: ReactTestInstance): boolean {
153+
if (parentElement === null || childElement === null) {
154+
return false;
155+
}
156+
157+
return (
158+
parentElement.findAll(
159+
node =>
160+
node.type === childElement.type && node.props === childElement.props,
161+
).length > 0
162+
);
163+
}
164+
168165
private isElementDisabled(element: ReactTestInstance): boolean {
169166
const { type } = element;
170167
const elementType = type.toString();

0 commit comments

Comments
 (0)