multimediaobject
Version:
Multimediaobject library
32 lines (29 loc) • 727 B
JavaScript
describe('utils.checkIfObject', () => {
const wrongArgs = [
undefined,
null,
[],
'test',
'',
'undefined',
'null',
];
wrongArgs.forEach((arg) => {
it(`should throw an error with ${arg}`, () => {
expect(() => {
utils.checkIfObject(arg, Object.keys(arg), 'this is an error message');
}).toThrow();
});
});
it('should not stop flow if arg is an object', () => {
expect(() => {
utils.checkIfObject({}, Object.keys({}), 'this is an error message');
}).toBeTruthy();
const testObj = {
test: 'test',
};
expect(() => {
utils.checkIfObject(testObj, Object.keys(testObj), 'this is an error message');
}).toBeTruthy();
});
});