is-local-path.test.js 659 B

123456789101112131415161718192021222324
  1. "use strict";
  2. const isLocalPath = require("./is-local-path");
  3. const path = require("path");
  4. describe("is-local-path", () => {
  5. it("returns true for paths beginning in the current directory", () => {
  6. const p = path.resolve(".", "test", "dir");
  7. expect(isLocalPath(p)).toBe(true);
  8. });
  9. it("returns true for absolute paths", () => {
  10. const p = path.join("/", "test", "dir");
  11. expect(isLocalPath(p)).toBe(true);
  12. });
  13. it("returns false for npm packages names", () => {
  14. expect(isLocalPath("webpack-addons-ylvis")).toBe(false);
  15. });
  16. it("returns false for scoped npm package names", () => {
  17. expect(isLocalPath("@webpack/test")).toBe(false);
  18. });
  19. });