const { GameObject, NPC, Humanoid, } = require('../src/prototype'); /* eslint-disable no-undef */ describe('prototype', () => { describe('GameObject', () => { const gameObject = new GameObject({ createdAt: new Date(), dimensions: { length: 5, width: 5, height: 15, }, }); it('', () => {}); it('should create an object with the properties: createdAt and dimensions', () => { expect(Object.prototype.hasOwnProperty.call(gameObject, 'createdAt')).toBe(true); expect(gameObject.createdAt instanceof Date).toBe(true); expect(Object.prototype.hasOwnProperty.call(gameObject, 'dimensions')).toBe(true); expect(gameObject.dimensions.length).toBe(5); }); it('should have the method .destroy() on its prototype', () => { expect(Object.prototype.hasOwnProperty.call(GameObject.prototype, 'destroy')).toBe(true); expect(Object.prototype.hasOwnProperty.call(GameObject, 'destroy')).toBe(false); expect(typeof GameObject.prototype.destroy).toBe('function'); }); it('.destroy() should return the string \'Game object was removed from the game.\'', () => { expect(gameObject.destroy()).toBe('Game object was removed from the game.'); }); }); describe('NPC', () => { const npc = new NPC({ createdAt: new Date(), dimensions: { length: 5, width: 5, height: 15, }, hp: 100, name: 'Foofie', }); it('should create an object with the properties: createdAt, dimensions (use GameObject to set these two), hp, and name', () => { expect(Object.prototype.hasOwnProperty.call(npc, 'createdAt')).toBe(true); expect(Object.prototype.hasOwnProperty.call(npc, 'dimensions')).toBe(true); expect(Object.prototype.hasOwnProperty.call(npc, 'hp')).toBe(true); expect(Object.prototype.hasOwnProperty.call(npc, 'name')).toBe(true); expect(npc.createdAt instanceof Date).toBe(true); expect(npc.dimensions.length).toBe(5); expect(npc.hp).toBe(100); expect(npc.name).toBe('Foofie'); }); it('should inherit the .destroy() method from GameObject', () => { expect(Object.prototype.hasOwnProperty.call(npc, 'destroy')).toBe(false); expect(Object.prototype.hasOwnProperty.call(Object.getPrototypeOf(NPC.prototype), 'destroy')).toBe(true); expect(npc.destroy()).toBe('Game object was removed from the game.'); }); it('should have the method .takeDamage() on its prototype', () => { expect(Object.prototype.hasOwnProperty.call(NPC.prototype, 'takeDamage')).toBe(true); expect(Object.prototype.hasOwnProperty.call(npc, 'takeDamage')).toBe(false); expect(typeof NPC.prototype.takeDamage).toBe('function'); }); it('.takeDamage() should return the string \'