mirror of
https://github.com/joelwmale/webhook-action.git
synced 2024-11-25 17:06:52 +01:00
24 lines
628 B
TypeScript
24 lines
628 B
TypeScript
|
import { assert } from "chai";
|
||
|
import { createMatchPath } from "../src/match-path-sync";
|
||
|
import * as Tests from "./data/match-path-data";
|
||
|
|
||
|
describe("match-path-sync", () => {
|
||
|
Tests.tests.forEach(t =>
|
||
|
it(t.name, () => {
|
||
|
const matchPath = createMatchPath(
|
||
|
t.absoluteBaseUrl,
|
||
|
t.paths,
|
||
|
t.mainFields,
|
||
|
t.addMatchAll
|
||
|
);
|
||
|
const result = matchPath(
|
||
|
t.requestedModule,
|
||
|
(_: string) => t.packageJson,
|
||
|
(name: string) => t.existingFiles.indexOf(name) !== -1, // fileExists
|
||
|
t.extensions
|
||
|
);
|
||
|
assert.equal(result, t.expectedPath);
|
||
|
})
|
||
|
);
|
||
|
});
|