diff --git a/packages/react/src/hooks/index.test.tsx b/packages/react/src/hooks/index.test.tsx index 90bf6998f..5a0d56a6f 100644 --- a/packages/react/src/hooks/index.test.tsx +++ b/packages/react/src/hooks/index.test.tsx @@ -1,4 +1,3 @@ -/* eslint-disable @typescript-eslint/no-empty-function */ import LogtoClient from '@logto/browser'; import { renderHook, act } from '@testing-library/react-hooks'; import { ComponentType } from 'react'; @@ -8,7 +7,7 @@ import { LogtoProvider } from '../provider'; const isAuthenticated = jest.fn(() => false); const isSignInRedirected = jest.fn(() => false); -const handleSignInCallback = jest.fn(async () => 0); +const handleSignInCallback = jest.fn().mockResolvedValue(undefined); const getAccessToken = jest.fn(() => { throw new Error('not authenticated'); }); @@ -20,8 +19,8 @@ jest.mock('@logto/browser', () => { isSignInRedirected, handleSignInCallback, getAccessToken, - signIn: jest.fn(async () => {}), - signOut: jest.fn(async () => {}), + signIn: jest.fn().mockResolvedValue(undefined), + signOut: jest.fn().mockResolvedValue(undefined), }; }); }); @@ -111,4 +110,3 @@ describe('useLogto', () => { }); }); }); -/* eslint-enable @typescript-eslint/no-empty-function */ diff --git a/packages/vue/src/index.test.ts b/packages/vue/src/index.test.ts index d42211ea8..2013040a7 100644 --- a/packages/vue/src/index.test.ts +++ b/packages/vue/src/index.test.ts @@ -1,4 +1,4 @@ -/* eslint-disable @typescript-eslint/no-empty-function */ +/* eslint-disable unicorn/no-useless-undefined */ import LogtoClient from '@logto/browser'; import { App, readonly } from 'vue'; @@ -9,7 +9,7 @@ import { createPluginMethods } from './plugin'; const isAuthenticated = jest.fn(async () => false); const isSignInRedirected = jest.fn(() => false); -const handleSignInCallback = jest.fn(async () => {}); +const handleSignInCallback = jest.fn().mockResolvedValue(undefined); const getAccessToken = jest.fn(() => { throw new Error('not authenticated'); }); @@ -24,8 +24,8 @@ jest.mock('@logto/browser', () => { isSignInRedirected, handleSignInCallback, getAccessToken, - signIn: jest.fn(async () => {}), - signOut: jest.fn(async () => {}), + signIn: jest.fn().mockResolvedValue(undefined), + signOut: jest.fn().mockResolvedValue(undefined), }; }); }); @@ -151,4 +151,4 @@ describe('useHandleSignInCallback', () => { expect(handleSignInCallback).toHaveBeenCalledTimes(1); }); }); -/* eslint-enable @typescript-eslint/no-empty-function */ +/* eslint-enable unicorn/no-useless-undefined */