-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
22 lines (19 loc) · 816 Bytes
/
test.js
File metadata and controls
22 lines (19 loc) · 816 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
test("should not throw with a valid absolute path", () => {
expect(() => {
require.resolve("/tmp/test");
}).not.toThrow();
});
test("should not throw with a valid absolute path and a valid path in `paths` option", () => {
expect(() => {
require.resolve("/tmp/test", { paths: ["/"] });
}).not.toThrow();
});
test("should not throw with a valid absolute path and an empty paths array option", () => {
expect(() => require.resolve("/tmp/test", { paths: [] })).not.toThrow();
});
test("should locate an absolute filename if given empty paths array", () => {
const explicitPath = require.resolve("/tmp/test");
const implicitPath = require.resolve("/tmp/test", { paths: [] });
expect(implicitPath).toEqual(explicitPath);
expect(implicitPath).toEqual(expect.stringContaining("/tmp/test"));
});