Firebase Stub: debounce callback called by "on" function

This commit is contained in:
gianantoniopini
2021-01-11 16:18:38 +01:00
parent dce5d2c591
commit 6c1fc543ad
5 changed files with 51 additions and 31 deletions

View File

@ -1,5 +1,6 @@
import React from 'react';
import { render } from '@testing-library/react';
import { render, screen } from '@testing-library/react';
import FirebaseStub, { DatabaseConstants } from 'gatsby-plugin-firebase';
import '../../i18n/index';
@ -10,6 +11,7 @@ describe('Castform', () => {
beforeEach(async () => {
FirebaseStub.database().initializeData();
const resumeId = DatabaseConstants.initialStateResumeId;
resume = (
await FirebaseStub.database()
@ -29,9 +31,9 @@ describe('Castform', () => {
const birthDateLabelMatcher = /Date of birth/i;
it('is not shown if not provided', () => {
const { queryByText } = render(<Castform data={resume} />);
render(<Castform data={resume} />);
expect(queryByText(birthDateLabelMatcher)).toBeNull();
expect(screen.queryByText(birthDateLabelMatcher)).toBeNull();
});
it('is shown if provided', () => {
@ -39,12 +41,12 @@ describe('Castform', () => {
const birthDateFormatted = '20 January 1990';
resume.profile.birthDate = birthDate;
const { getByText } = render(<Castform data={resume} />);
render(<Castform data={resume} />);
expect(getByText(birthDateLabelMatcher)).toBeTruthy();
expect(getByText(birthDateLabelMatcher)).toBeInTheDocument();
expect(getByText(birthDateFormatted)).toBeTruthy();
expect(getByText(birthDateFormatted)).toBeInTheDocument();
expect(screen.getByText(birthDateLabelMatcher)).toBeTruthy();
expect(screen.getByText(birthDateLabelMatcher)).toBeInTheDocument();
expect(screen.getByText(birthDateFormatted)).toBeTruthy();
expect(screen.getByText(birthDateFormatted)).toBeInTheDocument();
});
});
});