Skip to content

Commit ab7dafa

Browse files
committed
fixup! [New] Components.detect tracks React imports
1 parent 86420f8 commit ab7dafa

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

tests/util/Component.js

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,11 @@ describe('Components', () => {
8181
assert(defaultReactImport.local.name === 'React', 'default React import identifier should be "React"');
8282

8383
const namedReactImports = components.getNamedReactImports();
84-
assert(namedReactImports.length === 2, 'named React import identifiers should be "useCallback" and "useState"');
85-
assert(namedReactImports[0].local.name === 'useCallback', 'named React import identifiers should be "useCallback" and "useState"');
86-
assert(namedReactImports[1].local.name === 'useState', 'named React import identifiers should be "useCallback" and "useState"');
84+
assert.deepEqual(
85+
namedReactImports.map((specifier) => specifier.local.name),
86+
['useCallback', 'useState'],
87+
'named React import identifiers should be "useCallback" and "useState"'
88+
);
8789
});
8890
});
8991
});

0 commit comments

Comments
 (0)