Files
pybricks-code/src/explorer/alerts/FileInUseAlert.test.tsx
T
David Lechner e7366c8afd rework alerts
This starts moving alerts to the same subsystem where they are relevant
instead of putting everything in notifications.

So far, only the explorer file in use error is handled like this.
2022-05-20 19:25:18 -05:00

22 lines
642 B
TypeScript

// SPDX-License-Identifier: MIT
// Copyright (c) 2022 The Pybricks Authors
import React from 'react';
import { testRender } from '../../../test';
import { fileInUse } from './FileInUseAlert';
it('should be valid', () => {
const callback = jest.fn();
const toast = fileInUse(callback, { fileName: 'test.file' });
// TODO: refactor this to a common function to be used by all alerts
// it should render
const [message] = testRender(<>{toast.message}</>);
expect(message).toBeDefined();
// it should have a dismiss callback
toast.onDismiss?.(false);
expect(callback).toHaveBeenCalledWith('dismiss');
});