Skip to content
This repository was archived by the owner on Jul 30, 2020. It is now read-only.

Commit 37151a5

Browse files
author
Brandon Carroll
committed
WIP: filtering correctly by type
1 parent 9a809fe commit 37151a5

File tree

6 files changed

+468
-240
lines changed

6 files changed

+468
-240
lines changed

src/__tests__/filter.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

src/__tests__/query-helpers.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defaultFilter, filterNodeByType } from '../query-helpers';
1+
import { defaultFilter, filterNodeByType, proxyUnsafeProperties } from '../query-helpers';
22

33
test('filterNodeByType returns `true` when node.type matches the provided type', () => {
44
expect(filterNodeByType({ type: 'Text' }, 'Text')).toEqual(true);
@@ -13,3 +13,21 @@ test('defaultFilter returns `true` when node.type is in the mocked type list', (
1313
test('defaultFilter returns `false` when node.type is not in the mocked type list', () => {
1414
expect(defaultFilter({ type: 'Test' })).toEqual(false);
1515
});
16+
17+
test('proxyUnsafeProperties ignores what it should', () => {
18+
const testElement = proxyUnsafeProperties({
19+
_fiber: 'should work',
20+
findAllByProps: jest.fn(),
21+
findAllByType: jest.fn(),
22+
findByProps: jest.fn(),
23+
findByType: jest.fn(),
24+
instance: jest.fn(),
25+
});
26+
27+
expect(testElement._fiber).toBe('should work');
28+
expect(testElement.findAllByProps).toBe(undefined);
29+
expect(testElement.findAllByType).toBe(undefined);
30+
expect(testElement.findByProps).toBe(undefined);
31+
expect(testElement.findByType).toBe(undefined);
32+
expect(testElement.instance).toBe(undefined);
33+
});

0 commit comments

Comments
 (0)