import { testIconObject } from '../src/attributes/icon/object';
describe('Testing testIconObject', () => {
it('Objects', () => {
expect(
testIconObject({
body: '',
})
).toEqual({
body: '',
});
expect(
testIconObject({
body: '',
width: 24,
height: '32',
})
).toEqual({
body: '',
width: 24,
// Validation is simple, this will fail during render
height: '32',
});
// Invalid objects
expect(testIconObject({})).toBeUndefined();
expect(
testIconObject([
{
body: '',
},
])
).toBeUndefined();
expect(
testIconObject({
body: true,
})
).toBeUndefined();
});
it('String', () => {
expect(
testIconObject(
JSON.stringify({
body: '',
})
)
).toEqual({
body: '',
});
// Strings that are not objects
expect(testIconObject('foo')).toBeUndefined();
expect(testIconObject('{"body": ""')).toBeUndefined();
});
});