import { It } from "../test-utils";
import "./intersect";
import "./array";

It(
  "Will intersects on numbers",
  (g) => g.intersect([2, 3]).array(),
  [2, 3],
  [1, 2, 3]
);
It(
  "Will except on strings",
  (g) => g.intersect(["2", "3"]).array(),
  ["2", "3"],
  ["1", "2", "3"]
);
It(
  "Will except on booleans",
  (g) => g.intersect([false]).array(),
  [false],
  [true, false]
);
It(
  "Will except on custom comparitor",
  (g) =>
    g
      .intersect([{ test: 2 }, { test: 3 }], (a, b) => a.test === b.test)
      .array(),
  [{ test: 2 }, { test: 3 }],
  [{ test: 1 }, { test: 2 }, { test: 3 }]
);
It(
  "Will except on custom comparitor with a complex sequence",
  (g) =>
    g
      .intersect([{ test: 2 }, { test: 3 }], (a, b) => a.test === b.test)
      .array(),
  [{ test: 2 }, { test: 3 }, { test: 2 }, { test: 2 }],
  [
    { test: 1 },
    { test: 2 },
    { test: 3 },
    { test: 2 },
    { test: 4 },
    { test: 5 },
    { test: 1 },
    { test: 2 },
    { test: 4 },
  ]
);
