Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coreycosman/1776 tm field seed.spec.js update to 100 coverage #1837

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.
- Added compatibility to Gaia/SDK version 0.28.0-rc2 @faboweb
- [\#1673](https://github.com/cosmos/voyager/issues/1673) Documentation and single command to run one or all tests with fallback for end to end test @sabau
- [\#1683](https://github.com/cosmos/voyager/issues/1683) Governance: block voting twice for the same option @sabau
- [\#1774](https://github.com/cosmos/voyager/issues/1776) added specs for the TmFieldSeed update method and value watcher @coreycosman
- [\#1387](https://github.com/cosmos/voyager/issues/1387) Staking: Added list of undelegation transactions @sabau
- [\#1661](https://github.com/cosmos/voyager/issues/1661) Boot: multinode available for local-testnet @sabau
- [\#1748](https://github.com/cosmos/voyager/issues/1748) display governance parameters on tab @fedekunze
Expand Down
22 changes: 22 additions & 0 deletions test/unit/specs/components/common/TmFieldSeed.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,26 @@ describe(`TmFieldSeed`, () => {
it(`has the correct class`, () => {
expect(wrapper.find(`.tm-field`).classes()).toContain(`tm-field-seed`)
})

it(`emits input event on update method call`, () => {
wrapper.vm.update(`test event`)
expect(wrapper.emitted().input[0][0]).toEqual(`test event`)
})

it(`does not emit input event when update method not called`, () => {
expect(wrapper.emitted()).toEqual({})
})
it(`does not call autosize.update when value does not change`, async () => {
const autosize = require(`autosize`)
const spy = jest.spyOn(autosize, `update`)
expect(spy.mock.calls).toEqual([])
})
it(`calls autosize.update when value changes`, async () => {
const autosize = require(`autosize`)
const spy = jest.spyOn(autosize, `update`)
wrapper.setProps({ value: `change value` })
await wrapper.vm.$nextTick()
expect(spy).toBeCalled()
expect(spy.mock.calls[0].length).toEqual(1)
})
})