Sha256: 54118cc01cf4428d16ac6840a4ab56fa7a6857e34acbc24ee84fa1e474b534e1
Contents?: true
Size: 1.68 KB
Versions: 3
Compression:
Stored size: 1.68 KB
Contents
import { setProperties } from '..'; import { moduleFor, AbstractTestCase } from 'internal-test-helpers'; moduleFor( 'setProperties', class extends AbstractTestCase { ['@test supports setting multiple attributes at once'](assert) { assert.deepEqual(setProperties(null, null), null, 'noop for null properties and null object'); assert.deepEqual( setProperties(undefined, undefined), undefined, 'noop for undefined properties and undefined object' ); assert.deepEqual(setProperties({}), undefined, 'noop for no properties'); assert.deepEqual(setProperties({}, undefined), undefined, 'noop for undefined'); assert.deepEqual(setProperties({}, null), null, 'noop for null'); assert.deepEqual(setProperties({}, NaN), NaN, 'noop for NaN'); assert.deepEqual(setProperties({}, {}), {}, 'meh'); let props = setProperties({}, { foo: undefined }); assert.deepEqual(props, { foo: undefined }, 'Setting undefined value'); assert.ok('foo' in props, 'Setting undefined value'); assert.deepEqual(Object.keys(props), ['foo'], 'Setting undefined value'); assert.deepEqual(setProperties({}, { foo: 1 }), { foo: 1 }, 'Set a single property'); assert.deepEqual( setProperties({}, { foo: 1, bar: 1 }), { foo: 1, bar: 1 }, 'Set multiple properties' ); assert.deepEqual( setProperties({ foo: 2, baz: 2 }, { foo: 1 }), { foo: 1 }, 'Set one of multiple properties' ); assert.deepEqual( setProperties({ foo: 2, baz: 2 }, { bar: 2 }), { bar: 2, }, 'Set an additional, previously unset property' ); } } );
Version data entries
3 entries across 3 versions & 1 rubygems