Last active
May 23, 2022 18:24
-
-
Save ryanluker/bba7808e3b1bbd5fe33da8936731ec73 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as assert from "assert"; | |
import * as fs from "fs"; | |
// Original functions | |
const readFile = fs.readFile; | |
teardown(function() { | |
(fs as any).readFile = readFile; | |
}); | |
test("#load: Should reject when readFile returns an error @unit", function(done) { | |
const readFile = function(path: string, cb) { | |
assert.equal(path, "pathtofile"); | |
const error: NodeJS.ErrnoException = new Error("could not read from fs"); | |
return cb(error, Buffer.from("")); | |
}; | |
(fs as any).readFile = readFile; | |
const coverage = new Coverage( | |
fakeConfig, | |
); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment