|
| 1 | +import { describe, expect, it } from "vitest"; |
| 2 | +import { test, build } from "../../src/options/colorProfile"; |
| 3 | + |
| 4 | +describe("colorProfile", () => { |
| 5 | + describe("test", () => { |
| 6 | + it("should return true if color_profile option is defined", () => { |
| 7 | + expect(test({ color_profile: "srgb" })).toEqual(true); |
| 8 | + }); |
| 9 | + |
| 10 | + it("should return true if cp option is defined", () => { |
| 11 | + expect(test({ cp: "cmyk" })).toEqual(true); |
| 12 | + }); |
| 13 | + |
| 14 | + it("should return true if icc option is defined", () => { |
| 15 | + expect(test({ icc: "custom_profile" })).toEqual(true); |
| 16 | + }); |
| 17 | + |
| 18 | + it("should return false if color_profile option is undefined", () => { |
| 19 | + expect(test({})).toEqual(false); |
| 20 | + }); |
| 21 | + }); |
| 22 | + |
| 23 | + describe("build", () => { |
| 24 | + it("should throw an error if color_profile option is undefined", () => { |
| 25 | + expect(() => build({})).toThrow("color_profile option is undefined"); |
| 26 | + }); |
| 27 | + |
| 28 | + it("should return 'cp:srgb' if color_profile option is 'srgb'", () => { |
| 29 | + expect(build({ color_profile: "srgb" })).toEqual("cp:srgb"); |
| 30 | + }); |
| 31 | + |
| 32 | + it("should return 'cp:cmyk' if cp option is 'cmyk'", () => { |
| 33 | + expect(build({ cp: "cmyk" })).toEqual("cp:cmyk"); |
| 34 | + }); |
| 35 | + |
| 36 | + it("should return 'cp:custom_profile' if icc option is 'custom_profile'", () => { |
| 37 | + expect(build({ icc: "custom_profile" })).toEqual("cp:custom_profile"); |
| 38 | + }); |
| 39 | + |
| 40 | + it("should handle custom profile filename", () => { |
| 41 | + expect(build({ color_profile: "my-custom-profile" })).toEqual( |
| 42 | + "cp:my-custom-profile" |
| 43 | + ); |
| 44 | + }); |
| 45 | + |
| 46 | + it("should handle percent-encoded filename", () => { |
| 47 | + expect(build({ cp: "profile%20with%20spaces" })).toEqual( |
| 48 | + "cp:profile%20with%20spaces" |
| 49 | + ); |
| 50 | + }); |
| 51 | + }); |
| 52 | +}); |
0 commit comments