Skip to content
Prev Previous commit
Next Next commit
Restrict tests to the hooks that they shoud be testing
  • Loading branch information
davepwsmith committed Feb 11, 2020
commit e213075594f79e82236bdb350f9f85fceebacd09
9 changes: 0 additions & 9 deletions reactfire/firestore/firestore.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,10 @@ describe('Firestore', () => {

const ReadFirestoreDoc = () => {
const dataOnce = useFirestoreDocOnce<any>(ref);
const data = useFirestoreDoc<any>(ref);

return (
<>
<h1 data-testid="once">{dataOnce.exists.toString()}</h1>
<h1 data-testid="subscribe">{data.exists.toString()}</h1>
</>
);
};
Expand All @@ -134,11 +132,9 @@ describe('Firestore', () => {

await waitForElement(() => getByTestId('once'));
expect(getByTestId('once')).toContainHTML('false');
expect(getByTestId('subscribe')).toContainHTML('false');

await act(() => ref.set({ a: 'test' }));
expect(getByTestId('once')).toContainHTML('false');
expect(getByTestId('subscribe')).toContainHTML('true');
});
});

Expand All @@ -156,12 +152,10 @@ describe('Firestore', () => {

const ReadFirestoreDoc = () => {
const dataOnce = useFirestoreDocDataOnce<any>(ref, { idField: 'id' });
const data = useFirestoreDocData<any>(ref, { idField: 'id' });

return (
<>
<h1 data-testid="once">{dataOnce.a}</h1>{' '}
<h1 data-testid="subscribe">{data.a}</h1>
</>
);
};
Expand All @@ -177,12 +171,9 @@ describe('Firestore', () => {
await waitForElement(() => getByTestId('subscribe'));

expect(getByTestId('once')).toContainHTML(mockData1.a);
expect(getByTestId('subscribe')).toContainHTML(mockData1.a);

await act(() => ref.set(mockData2));

expect(getByTestId('once')).toContainHTML(mockData1.a);
expect(getByTestId('subscribe')).toContainHTML(mockData2.a);
});
});

Expand Down