Files
webstudio/apps/builder/app/shared/array-utils.test.ts
T
Bogdan Chadkin eb255b7dab Represent breakpoints as map (#1032)
Ref https://github.com/webstudio-is/webstudio-builder/issues/696

One more diff to support better conflict resolution in breakpoints
patches. Breakpoints is now map and patches rely on keys instead of
array indexes.
2023-02-15 17:01:06 +03:00

36 lines
639 B
TypeScript

import { expect, test } from "@jest/globals";
import { removeByMutable } from "./array-utils";
test("removeByMutable", () => {
const array = [
{ param: 1 },
{ param: 2 },
{ param: 3 },
{ param: 4 },
{ param: 5 },
{ param: 6 },
];
removeByMutable(array, (item) => item.param % 2 === 1);
expect(array).toMatchInlineSnapshot(`
[
{
"param": 2,
},
{
"param": 4,
},
{
"param": 6,
},
]
`);
removeByMutable(array, (item) => item.param !== 4);
expect(array).toMatchInlineSnapshot(`
[
{
"param": 4,
},
]
`);
});