spec: added additional tests to account for potential lookups of keys under values
Signed-off-by: Mark David Avery <mark@webark.cc>
This commit is contained in:
@@ -100,7 +100,6 @@ describe('parseEntityTransformParams', () => {
|
||||
'subite.with/dot': 'fd2.sub.dot',
|
||||
},
|
||||
'third-field-with.dot-again': 'fd3',
|
||||
type: 't',
|
||||
};
|
||||
|
||||
expect(
|
||||
@@ -129,4 +128,23 @@ describe('parseEntityTransformParams', () => {
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
it('does not return a sub key if an incorrect longer key is requested', () => {
|
||||
entity.spec = {
|
||||
...entity.spec,
|
||||
'field-with.dot': 'fd1',
|
||||
plain: true,
|
||||
numLike: 4,
|
||||
arrayLike: [4, 5],
|
||||
};
|
||||
|
||||
expect(
|
||||
parseEntityTransformParams({
|
||||
fields:
|
||||
'kind,spec.field-withdot.other.item,kind.other.other,spec.plain.other,spec.numLike.other,spec.arrayLike.other',
|
||||
})!(entity),
|
||||
).toEqual({
|
||||
kind: 'k',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user