UNPKG

@inlang/paraglide-js

Version:

[![Inlang-ecosystem compatibility badge](https://cdn.jsdelivr.net/gh/opral/monorepo@main/inlang/assets/md-badges/inlang.svg)](https://inlang.com)

27 lines (26 loc) 967 B
import { describe, it, expect } from "vitest"; import { pathExists } from "./exists.js"; import memfs from "memfs"; describe("fileExists", () => { it("returns true if the file does exist", async () => { const fs = memfs.Volume.fromNestedJSON({ "/test.txt": "hello", }).promises; const result = await pathExists("/test.txt", fs); expect(result).toBe(true); }); it("returns false if the file does not exist", async () => { const fs = memfs.Volume.fromNestedJSON({ "/test.txt": "hello", }).promises; const result = await pathExists("/does-not-exist.txt", fs); expect(result).toBe(false); }); it("returns true if the path is a directory", async () => { const fs = memfs.Volume.fromNestedJSON({ "/test/test.txt": "Hello", }).promises; const result = await pathExists("/test", fs); expect(result).toBe(true); }); });