UNPKG

@applicaster/zapplicaster-cli

Version:

CLI Tool for the zapp app and Quick Brick project

44 lines (36 loc) 1.32 kB
const { parseFonts } = require("../parseFonts"); const { FONTS, KAN_FONTS, GOOGLE_FONTS, WEB_FONTS, IRREGULAR_FONTS, UNSUPPORTED_FONTS, } = require("./fixtures/fonts"); describe("parseFonts returns an array of objects to create font face declarations", () => { describe("returns an array of objects with name, format, family, weight, and style", () => { it("when parsing customer fonts", () => { expect(parseFonts(FONTS.kan)).toEqual(KAN_FONTS); }); it("when parsing google fonts", () => { expect(parseFonts(FONTS.google)).toEqual(GOOGLE_FONTS); }); it("when parsing web fonts", () => { expect(parseFonts(FONTS.web)).toEqual(WEB_FONTS); }); it("when irregularly named fonts", () => { expect(parseFonts(FONTS.irregular)).toEqual(IRREGULAR_FONTS); }); }); describe("returns an empty array and logs a message on the console ", () => { it("when parsing unsupported fonts", () => { expect(parseFonts(FONTS.unsupported)).toEqual(UNSUPPORTED_FONTS); }); }); describe("returns undefined for fields it could not parse", () => { it("when parsing web fonts without style", () => { expect(parseFonts(FONTS.web)[1]).toHaveProperty("style"); expect(parseFonts(FONTS.web)[1].style).toBe(undefined); }); }); });