Skip to content

Commit

Permalink
fix: mock not complete
Browse files Browse the repository at this point in the history
  • Loading branch information
zzxming committed Sep 15, 2024
1 parent 35d6dd8 commit 0973942
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions packages/utils/__tests__/raf.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,15 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { caf, raf } from '..';

let isServerMocked = true;
vi.mock('../types', () => ({
get isServer() {
return isServerMocked;
},
}));
vi.mock('../types', async (importOriginal) => {
const mod = await importOriginal<typeof import('@cdx-component/hooks/use-support-touch')>();
return {
...mod,
get isServer() {
return isServerMocked;
},
};
});
describe('RAF and CAF Functions', () => {
beforeEach(() => {
vi.useFakeTimers();
Expand Down

0 comments on commit 0973942

Please sign in to comment.