Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
test('enumToIntEnumField#Good', t => {
const values = {zip: 0, zap: 1};
const goodObj = {
foo: 'zip'
};
const expObj = {
foo: 0
};
enumToIntField(values, 'foo', goodObj);
t.ok(JSON.stringify(goodObj) === JSON.stringify(expObj), 'Converted correct');
t.end();
});
t.throws(() => enumToIntField({a: 0}, 'foo', badObj), /Error/, 'Should throw error');