fix tests

This commit is contained in:
2018-04-04 12:49:41 +02:00
parent 6a5eb5a313
commit a418ddbe52
4 changed files with 12 additions and 6 deletions
+4 -3
View File
@@ -47,15 +47,16 @@ export default Ember.Controller.extend({
contributorsSorting: ['balance:desc'], contributorsSorting: ['balance:desc'],
contributorsSorted: Ember.computed.sort('contributorsWithKredits', 'contributorsSorting'), contributorsSorted: Ember.computed.sort('contributorsWithKredits', 'contributorsSorting'),
watchContractEvents: function() { init() {
this._super(...arguments);
this.get('kredits.kreditsContract') this.get('kredits.kreditsContract')
.then((contract) => { .then((contract) => {
contract.onproposalvoted = this._handleProposalVoted.bind(this); //function(a,b,c) { console.log('voted', a, b, c) } contract.onproposalvoted = this._handleProposalVoted.bind(this);
contract.onproposalcreated = this._handleProposalCreated.bind(this); contract.onproposalcreated = this._handleProposalCreated.bind(this);
contract.onproposalexecuted = this._handleProposalExecuted.bind(this); contract.onproposalexecuted = this._handleProposalExecuted.bind(this);
// TODO: transfer on the token contract // TODO: transfer on the token contract
}); });
}.on('init'), },
_handleProposalCreated(proposalId, creatorAddress, recipientAddress, amount) { _handleProposalCreated(proposalId, creatorAddress, recipientAddress, amount) {
if (Ember.isPresent(this.get('model.proposals') if (Ember.isPresent(this.get('model.proposals')
+1 -1
View File
@@ -45,7 +45,7 @@ export default Service.extend({
} else { } else {
debug('[kredits] Creating new instance from npm module class'); debug('[kredits] Creating new instance from npm module class');
let providerUrl = localStorage.getItem('config:web3ProviderUrl') || config.web3ProviderUrl; let providerUrl = localStorage.getItem('config:web3ProviderUrl') || config.web3ProviderUrl;
let networkId = config.contractMetadata.networkId; let networkId = parseInt(config.contractMetadata.networkId);
web3Provider = new ethers.providers.JsonRpcProvider(providerUrl, {chainId: networkId}); web3Provider = new ethers.providers.JsonRpcProvider(providerUrl, {chainId: networkId});
} }
+1 -1
View File
@@ -25695,7 +25695,7 @@
} }
}, },
"kredits-contracts": { "kredits-contracts": {
"version": "github:67P/truffle-kredits#7403eb3b80ca02553ebb9a954d600fcd56af24fb", "version": "github:67P/truffle-kredits#4d2ba2a4bf1bb3ceb1ae9c768abfc73a9cf5ab00",
"dev": true "dev": true
}, },
"lcid": { "lcid": {
+6 -1
View File
@@ -28,7 +28,12 @@ let addFixtures = function(controller) {
}; };
test('doesn\'t contain people with 0 balance', function(assert) { test('doesn\'t contain people with 0 balance', function(assert) {
let controller = this.subject(); // This is a bit strange... we do not want the controller to call the init function defined in the controller that
// initializes the event handlers on the contracts. Main reason is that we do not have proper contracts in test mode.
// this seems to work. but probably kills some controller stuff, which is fine in this test
let controller = this.subject({
init: function() { }
});
addFixtures(controller); addFixtures(controller);
let contributorsSorted = controller.get('contributorsSorted'); let contributorsSorted = controller.get('contributorsSorted');