mirror of
https://github.com/bringout/oca-ocb-core.git
synced 2026-04-20 11:12:05 +02:00
33 lines
1 KiB
JavaScript
33 lines
1 KiB
JavaScript
import { describe, expect, test } from "@odoo/hoot";
|
|
|
|
import { difference } from "@web/polyfills/set";
|
|
|
|
describe.current.tags("headless");
|
|
|
|
test("set difference", () => {
|
|
function test(s1, s2) {
|
|
let result;
|
|
try {
|
|
result = s1.difference(s2);
|
|
} catch {
|
|
expect(() => difference.call(s1, s2)).toThrow();
|
|
return;
|
|
}
|
|
expect(difference.call(s1, s2)).toEqual(result);
|
|
}
|
|
test(new Set([1, 2, 3]), new Set([])); // [1, 2, 3]
|
|
test(new Set([1, 2, 3]), new Set([1])); // [2, 3]
|
|
test(new Set([1, 2, 3]), new Set([1, 2, 3])); // []
|
|
test(new Set([1, 2, 3]), new Set([1, 2, 3, 5])); // []
|
|
test(new Set([1, 2, 3]), new Set([5, 6])); // []
|
|
test(new Set([]), new Set([1, 2, 3, 5])); // []
|
|
|
|
test(new Set([])); // throws
|
|
test(new Set([]), []); // throws
|
|
test(new Set([]), {}); // throws
|
|
test(new Set([]), 2); // throws
|
|
test(new Set([1])); // throws
|
|
test(new Set([1]), []); // throws
|
|
test(new Set([1]), {}); // throws
|
|
test(new Set([1]), 2); // throws
|
|
});
|