Creates a fake cockpit.file() return value.
cockpit.file()
Initial file content. Pass null to simulate a missing file (ENOENT).
null
Optional
When provided, read() and replace() reject with this message.
read()
replace()
vi.spyOn(cockpit, "file").mockReturnValue(mockCockpitFile("[Unit]\nDescription=test\n"));vi.spyOn(cockpit, "file").mockReturnValue(mockCockpitFile(null)); // missing file Copy
vi.spyOn(cockpit, "file").mockReturnValue(mockCockpitFile("[Unit]\nDescription=test\n"));vi.spyOn(cockpit, "file").mockReturnValue(mockCockpitFile(null)); // missing file
Creates a fake
cockpit.file()return value.