mirror of
https://github.com/Rain-kl/OpenFlare.git
synced 2026-09-30 22:26:38 +08:00
[优化] go 引用调整
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import '@testing-library/jest-dom/vitest';
|
||||
import { vi } from 'vitest';
|
||||
|
||||
const toastMock = vi.fn((msg) => {
|
||||
const el = document.createElement('div');
|
||||
el.textContent = typeof msg === 'string' ? msg : '';
|
||||
document.body.appendChild(el);
|
||||
return 'toast-id';
|
||||
});
|
||||
|
||||
vi.mock('sonner', () => ({
|
||||
toast: Object.assign(toastMock, {
|
||||
success: vi.fn((msg) => {
|
||||
const el = document.createElement('div');
|
||||
el.textContent = typeof msg === 'string' ? msg : '';
|
||||
document.body.appendChild(el);
|
||||
return 'toast-id';
|
||||
}),
|
||||
error: vi.fn((msg) => {
|
||||
const el = document.createElement('div');
|
||||
el.textContent = typeof msg === 'string' ? msg : '';
|
||||
document.body.appendChild(el);
|
||||
return 'toast-id';
|
||||
}),
|
||||
}),
|
||||
}));
|
||||
Reference in New Issue
Block a user