Created
April 24, 2020 15:00
-
-
Save jamesblashill/219d518de4f2a6c69801969a7f6945fe 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('ViewState', () => { | |
test('default state', () => { | |
const viewState = new ViewState(); | |
expect(viewState.showSomething).toBe(false); | |
}); | |
test('toggleShowingSomething()', () => { | |
const viewState = new ViewState(); | |
viewState.toggleShowingSomething(); | |
expect(viewState.showSomething).toBe(true); | |
viewState.toggleShowingSomething(); | |
expect(viewState.showSomething).toBe(false); | |
}); | |
}); |
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
class ViewState { | |
@observable | |
showSomething: boolean = false; | |
toggleShowingSomething() { | |
this.showSomething = !this.showSomething; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@psalv, I agree tests aren't adding value here. But they're also super simple to write and pave the way for future good behaviours. Thoughts?