hypertune
Version:
[Hypertune](https://www.hypertune.com/) is the most flexible platform for feature flags, A/B testing, analytics and app configuration. Built with full end-to-end type-safety, Git-style version control and local, synchronous, in-memory flag evaluation. Opt
38 lines (36 loc) • 1.22 kB
text/typescript
import { describe, expect, test } from "vitest";
import { areEqual } from "./reduce";
describe("areEqual", () => {
test.each([
["hello", "hello", true],
["hello", "hi", false],
[123, 123, true],
[123, 456, false],
[true, true, true],
[false, false, true],
[true, false, false],
[null, null, true],
[undefined, undefined, true],
[null, undefined, false],
[NaN, NaN, false],
[NaN, 7, false],
[[], [], true],
[[1], [1], true],
[[1], [2], false],
[[1], [1, 2], false],
[[1, 2], [1, 2], true],
[{}, {}, true],
[{ a: "123" }, { a: "123" }, true],
[{ a: "123" }, { a: "456" }, false],
[{ a: "123" }, { b: "123" }, false],
[{ a: "123", b: "456" }, { a: "123", b: "456" }, true],
[{ a: "123", b: "456" }, { a: "123" }, false],
[{ a: "123" }, { a: "123", b: "456" }, false],
[{ a: "123", b: "456" }, { a: "123", b: "789" }, false],
[{ a: "123", __typeName: "Thing" }, { a: "123", __typeName: "" }, true],
[{ a: "123", __typeName: "Thing" }, { a: "123" }, true],
[{ a: "123", __typeName: "Thing" }, { a: "456" }, false],
])("%s and %s: %s", (a, b, actual) => {
expect(areEqual(a, b)).toBe(actual);
});
});