Skip to content

Commit

Permalink
🪟 🐛 Fixes getAvailableSyncModesOptions function to return intersectio…
Browse files Browse the repository at this point in the history
…n of sync mode options (#22310)

* Fixes getAvailableSyncModesOptions function to return intersection of sync mode options

* Fixes getAvailableSyncModesOptions function unit test
  • Loading branch information
YatsukBogdan1 authored Feb 7, 2023
1 parent dcde74d commit 538d5ca
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,9 +210,7 @@ describe("<BulkEditPanel />", () => {

it("getAvailableSyncModesOptions should work correctly", () => {
const expectedResult: SyncModeOption[] = [
{ value: { syncMode: "incremental", destinationSyncMode: "append_dedup" } },
{ value: { syncMode: "full_refresh", destinationSyncMode: "overwrite" } },
{ value: { syncMode: "incremental", destinationSyncMode: "append" } },
{ value: { syncMode: "full_refresh", destinationSyncMode: "append" } },
];
const actualResult = getAvailableSyncModesOptions(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ export const getAvailableSyncModesOptions = (
syncModes?: DestinationSyncMode[]
): SyncModeOption[] =>
SUPPORTED_MODES.filter(([syncMode, destinationSyncMode]) => {
const supportableModes = intersection(nodes.flatMap((n) => n.stream?.supportedSyncModes));
const supportableModes = intersection(...nodes.map((n) => n.stream?.supportedSyncModes));
return supportableModes.includes(syncMode) && syncModes?.includes(destinationSyncMode);
}).map(([syncMode, destinationSyncMode]) => ({
value: { syncMode, destinationSyncMode },
Expand Down

0 comments on commit 538d5ca

Please sign in to comment.