Created
April 14, 2017 17:00
-
-
Save davidharting/7efcf1b30fe7316c16157534d9d1e574 to your computer and use it in GitHub Desktop.
Trouble with yayson presenter
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('weird that this fails', () => { | |
const yayson = require.requireActual('yayson') | |
it.only('should be able to render multiple times', () => { | |
const jsonApi = yayson({ adapter: 'default' }) | |
const presenter = new jsonApi.Presenter() | |
presenter.type = 'people' | |
console.log(presenter) | |
/* | |
* Presenter { scope: {}, type: 'people' } | |
*/ | |
presenter.render({ firstName: 'david', lastName: 'harting' }) | |
console.log(presenter) | |
/* | |
* Presenter { | |
* scope: { data: { type: 'people', attributes: [Object] } }, | |
* type: 'people' } | |
*/ | |
presenter.render({ firstName: 'blake', lastName: 'hair' }) | |
/* | |
* Error thrown: | |
* TypeError: this.scope.data.push is not a function | |
*/ | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment