mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-12 01:23:52 +00:00
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.
22 lines
642 B
TypeScript
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');
|
|
});
|