mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-07 22:15:45 +01:00
27 lines
594 B
JavaScript
27 lines
594 B
JavaScript
|
|
import { getPageFromMatch } from "./Changesets";
|
||
|
|
|
||
|
|
describe("tests for getPageFromMatch", () => {
|
||
|
|
function createMatch(page: string) {
|
||
|
|
return {
|
||
|
|
params: {
|
||
|
|
page
|
||
|
|
}
|
||
|
|
};
|
||
|
|
}
|
||
|
|
|
||
|
|
it("should return 1 for NaN", () => {
|
||
|
|
const match = createMatch("any");
|
||
|
|
expect(getPageFromMatch(match)).toBe(1);
|
||
|
|
});
|
||
|
|
|
||
|
|
it("should return 1 for 0", () => {
|
||
|
|
const match = createMatch("0");
|
||
|
|
expect(getPageFromMatch(match)).toBe(1);
|
||
|
|
});
|
||
|
|
|
||
|
|
it("should return the given number", () => {
|
||
|
|
const match = createMatch("42");
|
||
|
|
expect(getPageFromMatch(match)).toBe(42);
|
||
|
|
});
|
||
|
|
});
|