-
Notifications
You must be signed in to change notification settings - Fork 100
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
fail on console.error #256
Merged
Merged
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
7a1852c
fail on console.error
faboweb b22b6db
Merge branch 'develop' into fabo/255-fail-console-error
nylira b53a7fb
resolve test issue
nylira 88ce917
fix lint
nylira cb2fc18
capitalization
nylira 6e22cf7
extracted test setup for vuex tests
faboweb abb3126
extend nodemock
faboweb dc20361
test NiPage
faboweb b239c0f
use same eslintrc for test helpers
faboweb 002aef7
fail on uncaught
faboweb a279ba0
fix wallet commit unavailable
faboweb 7fccce0
improve vuex test setup
faboweb ceba7e2
improve tests
faboweb 0bb36c6
merged
faboweb a9529db
linted
faboweb f70de64
update circleci node version
faboweb 070c254
remove not needed frame buffer
faboweb 6909d9b
limit jest workers
faboweb c6f3fb3
only add unhandledRejection handler once
faboweb 36f4555
do not attach listeners to process in tests
faboweb f96fbdb
fixed unhandledRejection handler still being added
faboweb bf97d8f
extracted test setup to only be called once per suite
faboweb f640d71
removing worker limit for jest
faboweb File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -80,6 +80,8 @@ a | |
|
||
#app-content | ||
flex 1 | ||
display flex | ||
flex-flow column no-wrap | ||
|
||
.desktop-only | ||
display block |
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
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
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
File renamed without changes.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
global.console.error = (...args) => { | ||
throw new Error(args.join(' ')) | ||
} | ||
|
||
if (!process.env.LISTENING_TO_UNHANDLED_REJECTION) { | ||
process.on('unhandledRejection', reason => { | ||
throw reason | ||
}) | ||
// Avoid memory leak by adding too many listeners | ||
process.env.LISTENING_TO_UNHANDLED_REJECTION = true | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,24 @@ | ||
module.exports = { | ||
// rest | ||
getKey: () => ({}), | ||
generateKey: () => ({key: '123'}), | ||
queryAccount: () => null, | ||
queryNonce: () => '123', | ||
buildSend: (args) => { | ||
if (args.to.addr.indexOf('fail') !== -1) return Promise.reject('Failed on purpose') | ||
return Promise.resolve(null) | ||
}, | ||
coinTxs: () => Promise.resolve({}), | ||
candidates: () => Promise.resolve({data: []}), | ||
postTx: () => Promise.resolve({ | ||
check_tx: { code: 0 }, | ||
deliver_tx: { code: 0 } | ||
}), | ||
sign: () => Promise.resolve(null) | ||
sign: () => Promise.resolve(null), | ||
|
||
rpc: { | ||
on: () => {}, | ||
subscribe: () => {}, | ||
validators: () => [] | ||
} | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Vuex from 'vuex' | ||
import VueRouter from 'vue-router' | ||
import { shallow, mount, createLocalVue } from 'vue-test-utils' | ||
|
||
import routes from 'renderer/routes' | ||
|
||
const Modules = require('renderer/vuex/modules').default | ||
const Getters = require('renderer/vuex/getters') | ||
|
||
export default function vuexSetup () { | ||
const modules = Modules({ | ||
node: require('../helpers/node_mock') | ||
}) | ||
|
||
const localVue = createLocalVue() | ||
localVue.use(Vuex) | ||
localVue.use(VueRouter) | ||
|
||
function init (componentConstructor, testType = shallow, {stubs, getters = {}}) { | ||
let store = new Vuex.Store({ | ||
getters: Object.assign({}, Getters, getters), | ||
modules | ||
}) | ||
store.commit('setDevMode', true) | ||
|
||
jest.spyOn(store, 'dispatch') | ||
jest.spyOn(store, 'commit') | ||
|
||
let router = new VueRouter({routes}) | ||
|
||
return { | ||
store, | ||
router, | ||
wrapper: testType(componentConstructor, { | ||
localVue, store, router, stubs | ||
}) | ||
} | ||
} | ||
|
||
return { | ||
localVue, | ||
shallow: (componentConstructor, {stubs, getters} = {}) => init(componentConstructor, shallow, {stubs, getters}), | ||
mount: (componentConstructor, {stubs, getters} = {}) => init(componentConstructor, mount, {stubs, getters}) | ||
} | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import Vuex from 'vuex' | ||
import { mount, createLocalVue } from 'vue-test-utils' | ||
import NiPage from 'common/NiPage' | ||
|
||
const config = require('renderer/vuex/modules/config').default({}) | ||
|
||
const localVue = createLocalVue() | ||
localVue.use(Vuex) | ||
|
||
describe('NiPage', () => { | ||
let wrapper | ||
let store = new Vuex.Store({ | ||
getters: { | ||
config: () => config.state | ||
}, | ||
modules: { | ||
config | ||
} | ||
}) | ||
store.commit = jest.fn() | ||
|
||
beforeEach(() => { | ||
store.commit.mockReset() | ||
wrapper = mount(NiPage, { | ||
localVue, | ||
store, | ||
propsData: { | ||
title: 'Title', | ||
subtitle: 'Subtitle', | ||
icon: 'hello_icon' | ||
}, | ||
stubs: { | ||
'app-footer': '<app-footer />' | ||
} | ||
}) | ||
}) | ||
|
||
it('has the expected html structure', () => { | ||
expect(wrapper.vm.$el).toMatchSnapshot() | ||
}) | ||
}) |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line break?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was to structure rest endpoints away from the rpc object