Skip to content

Commit

Permalink
working test baseline
Browse files Browse the repository at this point in the history
  • Loading branch information
mzanoni committed Mar 26, 2024
1 parent d0fcf6b commit 8cd945a
Showing 1 changed file with 42 additions and 5 deletions.
47 changes: 42 additions & 5 deletions full-sync/tests/mapping/helpers.spec.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,47 @@
import { describe, expect, test } from '@jest/globals';
import { localizedToMultilingual } from '../src/mapping/helpers';
import { localizedToMultilingual } from '../../src/mapping/helpers';
import { DataValueFactory } from '@relewise/client';

describe('Testing helpers', () => {
test('localizedToMultilingual null value', () => {
test('localizedToMultilingual null value', () => {

localizedToMultilingual(null)
expect(1).toBe(1);
});
const result = localizedToMultilingual(undefined)
expect(result).toBe(null);
});
});

describe('Testing helpers', () => {
test('localizedToMultilingual 1 language', () => {

const subject = localizedToMultilingual({
"en": "test"
});

expect(subject).toStrictEqual(DataValueFactory.multilingual([{
language: "en",
value: "test"
}]));
});
});

describe('Testing helpers', () => {
test('localizedToMultilingual 2 languages', () => {

const subject = localizedToMultilingual({
"en": "test",
"da": "test2",
});

expect(subject).toStrictEqual(DataValueFactory.multilingual([
{
language: "en",
value: "test"
},
{
language: "da",
value: "test2"
}
]));
});
});

0 comments on commit 8cd945a

Please sign in to comment.