mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-19 10:57:19 +00:00
Add tests for get duplicates function (#24994)
This commit is contained in:
parent
6658c10b94
commit
20d357fb13
16
test/common/string/get_duplicate.test.ts
Normal file
16
test/common/string/get_duplicate.test.ts
Normal file
@ -0,0 +1,16 @@
|
||||
import { expect, test } from "vitest";
|
||||
import { getDuplicates } from "../../../src/common/string/get_duplicates";
|
||||
|
||||
test("getDuplicate", () => {
|
||||
expect(getDuplicates([])).toStrictEqual(new Set());
|
||||
expect(getDuplicates(["light", "vacuum", "switch"])).toStrictEqual(new Set());
|
||||
expect(getDuplicates(["light", "light", "vacuum", "switch"])).toStrictEqual(
|
||||
new Set(["light"])
|
||||
);
|
||||
expect(
|
||||
getDuplicates(["vacuum", "light", "light", "vacuum", "switch"])
|
||||
).toStrictEqual(new Set(["light", "vacuum"]));
|
||||
expect(getDuplicates(["light", "light", "light"])).toStrictEqual(
|
||||
new Set(["light"])
|
||||
);
|
||||
});
|
Loading…
x
Reference in New Issue
Block a user