Nicolò Ribaudo 04354d1556
Extract targets parser and compat data from preset-env (#10899)
* Extract targets parser and compat data from preset-env

* Review by Jùnliàng

* isItemRequired -> targetsSupported

* Export isRequired
2020-01-10 03:15:20 +01:00

33 lines
847 B
JavaScript

import { prettifyTargets, prettifyVersion } from "../lib/pretty";
describe("pretty", () => {
describe("prettifyVersion", () => {
it("returns", () => {
expect(prettifyVersion(true)).toBe(true);
expect(prettifyVersion("0.16.0")).toBe("0.16");
expect(prettifyVersion("1.0.0")).toBe("1");
expect(prettifyVersion("1.1.0")).toBe("1.1");
expect(prettifyVersion("1.0.2")).toBe("1.0.2");
expect(prettifyVersion("1.2.3")).toBe("1.2.3");
});
});
describe("prettifyTargets", () => {
it("returns", () => {
expect(prettifyTargets({})).toEqual({});
expect(
prettifyTargets({
chrome: "54.0.0",
electron: "1.6.0",
node: "0.12.0",
}),
).toEqual({
chrome: "54",
electron: "1.6",
node: "0.12",
});
});
});
});