Skip to content

Commit 770d890

Browse files
committed
test(tauri): add mock for readdirSync in pathResolver tests
- Introduced a mock implementation for `readdirSync` in `pathResolver.spec.ts` to enhance test coverage for scenarios where the directory is empty. - This addition ensures that the `isTauriAppBuilt` function is tested under various conditions, improving the reliability of the tests.
1 parent 8017cc1 commit 770d890

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

packages/tauri-service/test/pathResolver.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -262,6 +262,7 @@ describe('pathResolver', () => {
262262
it('should return true when binary exists', async () => {
263263
vi.mocked(existsSync).mockReturnValue(true);
264264
vi.mocked(readFileSync).mockReturnValue(JSON.stringify({ productName: 'MyApp', version: '1.0.0' }));
265+
vi.mocked(readdirSync).mockReturnValue([] as unknown as ReturnType<typeof readdirSync>);
265266

266267
const result = await isTauriAppBuilt('/app');
267268

0 commit comments

Comments
 (0)