mirror of
https://github.com/vector-im/element-call.git
synced 2026-07-12 18:39:19 +00:00
Merge pull request #4072 from element-hq/johannes/jest
Switch to jest-style assertions to please oxlint
This commit is contained in:
@@ -10,26 +10,26 @@ import { expect, test } from "vitest";
|
|||||||
import { redact } from "./redact";
|
import { redact } from "./redact";
|
||||||
|
|
||||||
test("empty object", () => {
|
test("empty object", () => {
|
||||||
expect(redact({})).to.deep.equal({});
|
expect(redact({})).toEqual({});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("no keys", () => {
|
test("no keys", () => {
|
||||||
expect(redact({ foo: "bar" })).to.deep.equal({ foo: "bar" });
|
expect(redact({ foo: "bar" })).toEqual({ foo: "bar" });
|
||||||
});
|
});
|
||||||
|
|
||||||
test("redact one key", () => {
|
test("redact one key", () => {
|
||||||
expect(redact({ foo: "bar" }, "foo")).to.deep.equal({ foo: "<redacted>" });
|
expect(redact({ foo: "bar" }, "foo")).toEqual({ foo: "<redacted>" });
|
||||||
});
|
});
|
||||||
|
|
||||||
test("redact two keys", () => {
|
test("redact two keys", () => {
|
||||||
expect(redact({ foo: "bar", bar: "foo" }, "foo", "bar")).to.deep.equal({
|
expect(redact({ foo: "bar", bar: "foo" }, "foo", "bar")).toEqual({
|
||||||
foo: "<redacted>",
|
foo: "<redacted>",
|
||||||
bar: "<redacted>",
|
bar: "<redacted>",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("no redaction of unrelated keys", () => {
|
test("no redaction of unrelated keys", () => {
|
||||||
expect(redact({ foo: "bar", bar: "foo" }, "foo")).to.deep.equal({
|
expect(redact({ foo: "bar", bar: "foo" }, "foo")).toEqual({
|
||||||
foo: "<redacted>",
|
foo: "<redacted>",
|
||||||
bar: "foo",
|
bar: "foo",
|
||||||
});
|
});
|
||||||
@@ -38,20 +38,20 @@ test("no redaction of unrelated keys", () => {
|
|||||||
test("no redaction of missing keys", () => {
|
test("no redaction of missing keys", () => {
|
||||||
expect(
|
expect(
|
||||||
redact({ foo: "bar" } as { foo: string; bar: string | undefined }, "bar"),
|
redact({ foo: "bar" } as { foo: string; bar: string | undefined }, "bar"),
|
||||||
).to.deep.equal({
|
).toEqual({
|
||||||
foo: "bar",
|
foo: "bar",
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("no redaction of null values", () => {
|
test("no redaction of null values", () => {
|
||||||
expect(redact({ foo: "bar", bar: null }, "bar")).to.deep.equal({
|
expect(redact({ foo: "bar", bar: null }, "bar")).toEqual({
|
||||||
foo: "bar",
|
foo: "bar",
|
||||||
bar: null,
|
bar: null,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("no redaction of undefined values", () => {
|
test("no redaction of undefined values", () => {
|
||||||
expect(redact({ foo: "bar", bar: undefined }, "bar")).to.deep.equal({
|
expect(redact({ foo: "bar", bar: undefined }, "bar")).toEqual({
|
||||||
foo: "bar",
|
foo: "bar",
|
||||||
bar: undefined,
|
bar: undefined,
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user