Skip to content

Commit

Permalink
fix: inputHelpers tests regression
Browse files Browse the repository at this point in the history
Signed-off-by: Olga Nad <[email protected]>
  • Loading branch information
olga-union committed Sep 7, 2022
1 parent f98563b commit 78f1a32
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const baseInputProps: InputProps = {
onChange: () => {},
required: false,
typeDefinition: inputTypes.unknown,
setIsError: () => {},
};

function makeSimpleInput(typeDefinition: InputTypeDefinition, value: any): InputProps {
Expand Down Expand Up @@ -98,7 +99,7 @@ describe('literalToInputValue', () => {
});
});

it('should return empty for noneType literals', () => {
it('should return literal as an empty object for noneType literals', () => {
const map: Core.ILiteral = {
map: {
literals: { a: literalNone() },
Expand All @@ -110,7 +111,9 @@ describe('literalToInputValue', () => {
type: InputType.None,
};

expect(literalToInputValue(mapInputTypeDefinition(typeDefinition), map)).toEqual('{}');
expect(literalToInputValue(mapInputTypeDefinition(typeDefinition), map)).toEqual(`{
"a": {}
}`);
});
});

Expand All @@ -135,7 +138,7 @@ describe('literalToInputValue', () => {
});
});

it('should return empty for noneType literals', () => {
it('should return empty objects for each noneType literals', () => {
const collection: Core.ILiteral = {
collection: {
// Duplicate it to test comma separation
Expand All @@ -150,7 +153,7 @@ describe('literalToInputValue', () => {

expect(
literalToInputValue(collectionInputTypeDefinition(typeDefinition), collection),
).toEqual('[]');
).toEqual('[{},{}]');
});
});

Expand Down

0 comments on commit 78f1a32

Please sign in to comment.