@difizen/mana-common
Version:
23 lines (19 loc) • 635 B
text/typescript
import assert from 'assert';
import { isPlainObject, getPropertyDescriptor } from './';
describe('Utils', () => {
it('#plainObject', async () => {
assert(isPlainObject({}));
assert(!isPlainObject(null));
assert(!isPlainObject(undefined));
const data = Object.create(null);
assert(isPlainObject(data));
const data1 = Object.create(data);
assert(!isPlainObject(data1));
});
it('#descriptor', async () => {
const obj = Object.freeze({ a: {} });
const describe = getPropertyDescriptor(obj, 'a');
assert(describe?.configurable === false);
assert(describe?.writable === false);
});
});