more code coverage

This commit is contained in:
David Lechner
2023-03-08 15:07:16 -06:00
committed by David Lechner
parent 5fa0e90783
commit af160c99a8
28 changed files with 580 additions and 40 deletions
@@ -0,0 +1,18 @@
// SPDX-License-Identifier: MIT
// Copyright (c) 2022-2023 The Pybricks Authors
import { Toast } from '@blueprintjs/core';
import React from 'react';
import { testRender } from '../../../test';
import { updateServerFailure } from './UpdateServerFailure';
it('should dismiss when close is clicked', async () => {
const callback = jest.fn();
const toast = updateServerFailure(callback, undefined as never);
const [user, message] = testRender(<Toast {...toast} />);
await user.click(message.getByRole('button', { name: /close/i }));
expect(callback).toHaveBeenCalledWith('dismiss');
});