mirror of
https://github.com/webstudio-is/webstudio.git
synced 2026-11-08 04:55:06 +09:00
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.
36 lines
639 B
TypeScript
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,
|
|
},
|
|
]
|
|
`);
|
|
});
|