Created
September 13, 2016 14:46
-
-
Save sminutoli/dcca8e80055165a811da11e1f72983f8 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
describe('Item', ()=>{ | |
function setup(){ | |
const data = { | |
name: 'test', | |
image: 'http://placeimg.com/400/300/people/grayscale', | |
available: true | |
}; | |
const anItem = Item.from(data); | |
return { data, anItem }; | |
} | |
it('should delegate on EnhancedObject', ()=>{ | |
const actual = EnhancedObject.isPrototypeOf(Item); | |
expect(actual).toBe(true); | |
}); | |
it('should delegate on Renderizable', ()=>{ | |
const actual = Renderizable.isPrototypeOf(Item); | |
expect(actual).toBe(true); | |
}); | |
it('should render the title', ()=>{ | |
const { data, anItem } = setup(); | |
const html = anItem.toHTML(); | |
const actual = $(html).find('h2').text(); | |
expect(actual).toBe(data.name); | |
}); | |
it('should render the image', ()=>{ | |
const { data, anItem } = setup(); | |
const html = anItem.toHTML(); | |
const actual = $(html).find('img').attr('src'); | |
expect(actual).toBe(data.image); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment