diff options
Diffstat (limited to 'test/bun.js')
| l--------- | test/bun.js/fs-stream.link.js | 1 | ||||
| -rw-r--r-- | test/bun.js/fs.test.js | 61 | ||||
| -rw-r--r-- | test/bun.js/snapshots.debug.js | 10 | ||||
| -rw-r--r-- | test/bun.js/snapshots.js | 10 |
4 files changed, 82 insertions, 0 deletions
diff --git a/test/bun.js/fs-stream.link.js b/test/bun.js/fs-stream.link.js new file mode 120000 index 000000000..0cadae0e5 --- /dev/null +++ b/test/bun.js/fs-stream.link.js @@ -0,0 +1 @@ +./test/bun.js/fs-stream.js
\ No newline at end of file diff --git a/test/bun.js/fs.test.js b/test/bun.js/fs.test.js index 79ac60eaa..d3c6be901 100644 --- a/test/bun.js/fs.test.js +++ b/test/bun.js/fs.test.js @@ -11,6 +11,8 @@ import { readSync, writeFileSync, writeSync, + statSync, + lstatSync, } from "node:fs"; const Buffer = globalThis.Buffer || Uint8Array; @@ -242,3 +244,62 @@ describe("writeFileSync", () => { } }); }); + +describe("lstat", () => { + it("file metadata is correct", () => { + const fileStats = lstatSync( + new URL("./fs-stream.js", import.meta.url) + .toString() + .slice("file://".length - 1) + ); + expect(fileStats.isSymbolicLink()).toBe(false); + expect(fileStats.isFile()).toBe(true); + expect(fileStats.isDirectory()).toBe(false); + }); + + it("folder metadata is correct", () => { + const fileStats = lstatSync( + new URL("../../test", import.meta.url) + .toString() + .slice("file://".length - 1) + ); + expect(fileStats.isSymbolicLink()).toBe(false); + expect(fileStats.isFile()).toBe(false); + expect(fileStats.isDirectory()).toBe(true); + }); + + it("symlink metadata is correct", () => { + const linkStats = lstatSync( + new URL("./fs-stream.link.js", import.meta.url) + .toString() + .slice("file://".length - 1) + ); + expect(linkStats.isSymbolicLink()).toBe(true); + expect(linkStats.isFile()).toBe(false); + expect(linkStats.isDirectory()).toBe(false); + }); +}); + +describe("stat", () => { + it("file metadata is correct", () => { + const fileStats = statSync( + new URL("./fs-stream.js", import.meta.url) + .toString() + .slice("file://".length - 1) + ); + expect(fileStats.isSymbolicLink()).toBe(false); + expect(fileStats.isFile()).toBe(true); + expect(fileStats.isDirectory()).toBe(false); + }); + + it("folder metadata is correct", () => { + const fileStats = statSync( + new URL("../../test", import.meta.url) + .toString() + .slice("file://".length - 1) + ); + expect(fileStats.isSymbolicLink()).toBe(false); + expect(fileStats.isFile()).toBe(false); + expect(fileStats.isDirectory()).toBe(true); + }); +}); diff --git a/test/bun.js/snapshots.debug.js b/test/bun.js/snapshots.debug.js new file mode 100644 index 000000000..d4c345677 --- /dev/null +++ b/test/bun.js/snapshots.debug.js @@ -0,0 +1,10 @@ + +// test/bun.js/module-require.snapshot.js +import { +__require as require +} from "bun:wrap"; +console.log(import.meta.require("/Users/jarred/Code/bun/node_modules/react/index.js")); + +// test/bun.js/require-referenceerror.snapshot.js + +// test/bun.js/tiny-typed-emitter.snapshot.js diff --git a/test/bun.js/snapshots.js b/test/bun.js/snapshots.js new file mode 100644 index 000000000..d4c345677 --- /dev/null +++ b/test/bun.js/snapshots.js @@ -0,0 +1,10 @@ + +// test/bun.js/module-require.snapshot.js +import { +__require as require +} from "bun:wrap"; +console.log(import.meta.require("/Users/jarred/Code/bun/node_modules/react/index.js")); + +// test/bun.js/require-referenceerror.snapshot.js + +// test/bun.js/tiny-typed-emitter.snapshot.js |
