match-path-sync.test.ts 627 B

1234567891011121314151617181920212223
  1. import { createMatchPath } from "../match-path-sync";
  2. import * as Tests from "./data/match-path-data";
  3. describe("match-path-sync", () => {
  4. Tests.tests.forEach((t) =>
  5. it(t.name, () => {
  6. const matchPath = createMatchPath(
  7. t.absoluteBaseUrl,
  8. t.paths,
  9. t.mainFields,
  10. t.addMatchAll
  11. );
  12. const result = matchPath(
  13. t.requestedModule,
  14. (_: string) => t.packageJson,
  15. (name: string) => t.existingFiles.indexOf(name) !== -1,
  16. t.extensions
  17. );
  18. // assert.equal(result, t.expectedPath);
  19. expect(result).toBe(t.expectedPath);
  20. })
  21. );
  22. });