Update WelcomeTitle.test.tsx
Signed-off-by: Gaurav Pandey <36168816+grvpandey11@users.noreply.github.com>
This commit is contained in:
@@ -20,7 +20,7 @@ import { WelcomeTitle } from './WelcomeTitle';
|
||||
describe('<WelcomeTitle>', () => {
|
||||
afterEach(() => jest.resetAllMocks());
|
||||
|
||||
test('should greet user', async () => {
|
||||
test('should greet user with default greeting', async () => {
|
||||
jest
|
||||
.spyOn(global.Date, 'now')
|
||||
.mockImplementation(() => new Date('1970-01-01T23:00:00').valueOf());
|
||||
@@ -29,4 +29,17 @@ describe('<WelcomeTitle>', () => {
|
||||
|
||||
expect(getByText(/Get some rest, Guest/)).toBeInTheDocument();
|
||||
});
|
||||
|
||||
test('should greet user with multiple languages', async () => {
|
||||
jest
|
||||
.spyOn(global.Date, 'now')
|
||||
.mockImplementation(() => new Date('2023-07-03T14:00:00').valueOf());
|
||||
|
||||
const languages = ['English', 'Spanish'];
|
||||
const { getByText } = await renderInTestApp(
|
||||
<WelcomeTitle language={languages} />,
|
||||
);
|
||||
|
||||
expect(getByText(/Good afternoon, Guest/)).toBeInTheDocument();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user