-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathpodfile-parser.test.ts
32 lines (29 loc) · 1.24 KB
/
podfile-parser.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import * as path from "path";
import { getVersionFromPodfile, getVersionFromPodfileLine } from "../src/podfile-parser";
describe("getVersionFromPodfile", () => {
it.each([
["Podfile.lock", "1.5.3"],
["Podfile2.lock", "1.9.3"],
["Podfile3.lock", "1.10.0.rc.1"],
["Podfile4.lock", "1.9.0.beta.2"]
])("test case %#", (input: string, expected: string | null) => {
const testCasePath = path.resolve(path.join(__dirname, "podfile-example", input));
expect(getVersionFromPodfile(testCasePath)).toBe(expected);
});
it("fails on invalid podfile", () => {
const testCasePath = path.resolve(path.join(__dirname, "podfile-example", "Podfile5.lock"));
expect(() => getVersionFromPodfile(testCasePath)).toThrow();
});
});
describe("getVersionFromPodfileLine", () => {
it.each([
["COCOAPODS: 1.5.3", "1.5.3"],
["COCOAPODS: 1.9.1", "1.9.1"],
["COCOAPODS: 1.10.0.rc.1", "1.10.0.rc.1"],
["COCOAPODS: 1.8.0.beta.2", "1.8.0.beta.2"],
["COCOAPODS: 1.7.0.beta.1", "1.7.0.beta.1"],
])("%s -> %s", (input: string, expected: string) => {
const matchedVersion = getVersionFromPodfileLine(input);
expect(matchedVersion).toBe(expected);
});
});