Skip to content

Commit

Permalink
add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mzanoni committed Mar 27, 2024
1 parent 9f3c93c commit 9279995
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion full-sync/tests/mapping/helpers.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { describe, expect, test } from '@jest/globals';
import { localizedToLanguageLookUp, localizedToMultilingual } from '../../src/mapping/helpers';
import { localizedToLanguageLookUp, localizedToMultilingual, searchKeywordsToMultilingual } from '../../src/mapping/helpers';
import { DataValueFactory } from '@relewise/client';
import { SearchKeywords } from '@commercetools/platform-sdk';

describe('Testing helpers', () => {
test('localizedToMultilingual null value', () => {
Expand Down Expand Up @@ -59,4 +60,25 @@ describe('Testing helpers', () => {
}
]);
});

test('searchKeywordsToMultilingual 2 languages', () => {

const subject: SearchKeywords = {
"en": [{ text: "test" }],
"da": [{ text: "test2" }],
}

const result = searchKeywordsToMultilingual(subject);

expect(result).toStrictEqual(DataValueFactory.multilingualCollection([
{
language: "en",
values: ["test"]
},
{
language: "da",
values: ["test2"]
}
]));
});
});

0 comments on commit 9279995

Please sign in to comment.