Skip to content

Commit 795446d

Browse files
committed
Do not use inner function
1 parent 84baa60 commit 795446d

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
@@ -169,29 +169,26 @@ export class ElementAssertion extends Assertion<ReactTestInstance> {
169169
message: `Expected element ${this.toString()} NOT to contain element ${instanceToString(element)}.`,
170170
});
171171

172-
const isElementContained = (
173-
parentElement: ReactTestInstance,
174-
childElement: ReactTestInstance,
175-
): boolean => {
176-
if (parentElement === null || childElement === null) {
177-
return false;
178-
}
179-
180-
return (
181-
parentElement.findAll(
182-
node =>
183-
node.type === childElement.type && node.props === childElement.props,
184-
).length > 0
185-
);
186-
};
187-
188172
return this.execute({
189-
assertWhen: isElementContained(this.actual, element),
173+
assertWhen: this.isElementContained(this.actual, element),
190174
error,
191175
invertedError,
192176
});
193177
}
194178

179+
private isElementContained(parentElement: ReactTestInstance, childElement: ReactTestInstance): boolean {
180+
if (parentElement === null || childElement === null) {
181+
return false;
182+
}
183+
184+
return (
185+
parentElement.findAll(
186+
node =>
187+
node.type === childElement.type && node.props === childElement.props,
188+
).length > 0
189+
);
190+
}
191+
195192
private isElementDisabled(element: ReactTestInstance): boolean {
196193
const { type } = element;
197194
const elementType = type.toString();

0 commit comments

Comments
 (0)