import { hasAnnotations } from "../utils";
import { RichText } from "../types";

const testRichText1 = [
  {
    type: "text",
    plain_text: "Noir",
    annotations: {
      bold: false,
      italic: false,
      strikethrough: false,
      underline: false,
      code: false,
      color: "default",
    },
    href: null,
  },
] as RichText[];
const testRichText2 = [
  {
    type: "text",
    plain_text: "Noir",
    annotations: {
      bold: false,
      italic: false,
      strikethrough: false,
      underline: false,
      code: true,
      color: "default",
    },
    href: null,
  },
] as RichText[];
const testRichText3 = [
  {
    type: "text",
    plain_text: "Noir",
    annotations: {
      bold: false,
      italic: false,
      strikethrough: false,
      underline: false,
      code: false,
      color: "pink",
    },
    href: null,
  },
] as RichText[];
const testRichText4 = [
  {
    type: "text",
    plain_text: "Noir",
    annotations: {
      bold: false,
      italic: false,
      strikethrough: false,
      underline: false,
      code: false,
      color: "default",
    },
    href: "somelink",
  },
] as RichText[];
describe("Testing annotations", () => {
  it("Don't have annotations", () => {
    //@ts-ignore
    expect(hasAnnotations(testRichText1)).toBe(false);
  });
  it("Has annotations", () => {
    //@ts-ignore
    expect(hasAnnotations(testRichText2)).toBe(true);
  });
  it("Has color", () => {
    //@ts-ignore
    expect(hasAnnotations(testRichText3)).toBe(true);
  });
  it("Has link", () => {
    //@ts-ignore
    expect(hasAnnotations(testRichText4)).toBe(true);
  });
});
