UNPKG

@sap_oss/wdio-qmate-service

Version:

[![REUSE status](https://api.reuse.software/badge/github.com/SAP/wdio-qmate-service)](https://api.reuse.software/info/github.com/SAP/wdio-qmate-service)[![Node.js CI](https://github.com/SAP/wdio-qmate-service/actions/workflows/node.js.yml/badge.svg)](http

27 lines (21 loc) 610 B
import { describe, it, vi, beforeEach, afterAll, expect } from "vitest"; import { getUserId } from "../../../src/scripts/stats/getUserId"; vi.mock("os", () => { return { homedir: vi.fn().mockImplementation(() => { throw new Error("Home directory not accessible") }) }; }); describe("getUserId - error case", () => { beforeEach(() => { vi.clearAllMocks(); }); it("should return null if home directory is not accessible", async () => { // Act const userId = await getUserId(); // Verify expect(userId).toBeNull(); }); afterAll(() => { vi.clearAllMocks(); }); });