Esempio n. 1
0
 it(`should reference the "static" parent, surrogate, and child properties`, () => {
     expect(hasOwn(ChildConstructor, `parentStaticProp`)).toBe(true);
     expect(ChildConstructor.parentStaticProp).toBe(parentStaticPropObj);
     expect(hasOwn(ChildConstructor, `surrogateStaticProp`)).toBe(true);
     expect(ChildConstructor.surrogateStaticProp).toBe(surrogateStaticPropObj);
     expect(hasOwn(ChildConstructor, `childStaticProp`)).toBe(true);
     expect(ChildConstructor.childStaticProp).toBe(childStaticPropObj);
 });
Esempio n. 2
0
 it(`should reference the "static" parent, surrogate, and child methods`, () => {
     expect(hasOwn(ChildConstructor, `parentStaticMethod`)).toBe(true);
     expect(ChildConstructor.parentStaticMethod).toBe(parentStaticMethodFn);
     expect(hasOwn(ChildConstructor, `surrogateStaticMethod`)).toBe(true);
     expect(ChildConstructor.surrogateStaticMethod).toBe(surrogateStaticMethodFn);
     expect(hasOwn(ChildConstructor, `childStaticMethod`)).toBe(true);
     expect(ChildConstructor.childStaticMethod).toBe(childStaticMethodFn);
 });
Esempio n. 3
0
 it(`should reference the "prototype" parent and child properties`, () => {
     expect(hasOwn(ChildConstructor.prototype.parentProtoProp)).toBe(false);
     expect(hasOwn(childInstance.parentProtoProp)).toBe(false);
     expect(ChildConstructor.prototype.parentProtoProp).toBe(parentProtoPropObj);
     expect(childInstance.parentProtoProp).toBe(parentProtoPropObj);
     expect(hasOwn(ChildConstructor.prototype, `childProtoProp`)).toBe(true);
     expect(hasOwn(childInstance, `childProtoProp`)).toBe(false);
     expect(ChildConstructor.prototype.childProtoProp).toBe(childProtoPropObj);
     expect(childInstance.childProtoProp).toBe(childProtoPropObj);
 });
Esempio n. 4
0
 it(`should reference the "prototype" parent and child methods`, () => {
     expect(hasOwn(ChildConstructor.prototype, `parentProtoMethod`)).toBe(false);
     expect(hasOwn(childInstance, `parentProtoMethod`)).toBe(false);
     expect(ChildConstructor.prototype.parentProtoMethod).toBe(parentProtoMethodFn);
     expect(childInstance.parentProtoMethod).toBe(parentProtoMethodFn);
     expect(hasOwn(ChildConstructor.prototype, `childProtoMethod`)).toBe(true);
     expect(hasOwn(childInstance, `childProtoMethod`)).toBe(false);
     expect(ChildConstructor.prototype.childProtoMethod).toBe(childProtoMethodFn);
     expect(childInstance.childProtoMethod).toBe(childProtoMethodFn);
 });
Esempio n. 5
0
 it(`should not error if called on "null" or "undefined"`, () => {
     expect(hasOwn()).toBe(false);
     expect(hasOwn(null)).toBe(false);
     expect(hasOwn(undefined)).toBe(false);
     expect(hasOwn(normalObj)).toBe(false);
     expect(hasOwn(normalObj, null)).toBe(false);
     expect(hasOwn(normalObj, undefined)).toBe(false);
 });
Esempio n. 6
0
 it(`should still work`, () => {
     expect(hasOwn(normalObj, `testProp`)).toBe(true);
 });
Esempio n. 7
0
 it(`should not match "prototype" properties`, () => {
     expect(hasOwn(classObj, `testProp`)).toBe(false);
 });
Esempio n. 8
0
 it(`should match properties present on instances`, () => {
     expect(hasOwn(classObj, `localProp`)).toBe(true);
 });
Esempio n. 9
0
 it(`should still work even when the "hasOwnProperty" has been redefined`, () => {
     expect(hasOwn(normalObj, `hasOwnProperty`)).toBe(true);
 });
Esempio n. 10
0
 it(`should not be error on properties that have not been defined`, () => {
     expect(hasOwn(normalObj, `missingProp`)).toBe(false);
 });