Skip to content

Commit

Permalink
pass apply and invoices tests
Browse files Browse the repository at this point in the history
  • Loading branch information
gr0uch authored and kleinsch committed Nov 21, 2013
1 parent f66b40c commit 25497ea
Show file tree
Hide file tree
Showing 25 changed files with 2,515 additions and 16,154 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: node_js
node_js:
- 0.10
#before_script:
# - export DISPLAY=:99.0
# - sh -e /etc/init.d/xvfb start
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
4 changes: 2 additions & 2 deletions app/components/order_customer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ Balanced.OrderCustomerComponent = Ember.Component.extend({

debits.forEach(function(debit) {
var amount = debit.get('amount');
if(debit.get('status') === 'succeeded') {
if (debit.get('status') === 'succeeded') {
amounts.debited += amount;
} else {
amounts.pending += amount;
Expand All @@ -46,7 +46,7 @@ Balanced.OrderCustomerComponent = Ember.Component.extend({

credits.forEach(function(credit) {
var amount = credit.get('amount');
if(credit.get('status') === 'succeeded') {
if (credit.get('status') === 'succeeded') {
amounts.credited += amount;
} else {
amounts.pending += amount;
Expand Down
3 changes: 2 additions & 1 deletion app/models/core/adapters/fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Balanced.FixtureAdapter = Balanced.BaseAdapter.extend({
type: type,
uri: uri
});

// cloning in case people modify this later, don't want to screw up our fixtures!
var clonedJson = this._cloneObject(json);

Expand Down Expand Up @@ -82,7 +83,7 @@ Balanced.FixtureAdapter = Balanced.BaseAdapter.extend({
},

addFixture: function(json) {
this.dataMap[json.uri] = json;
this.dataMap[json.href || json.uri] = json;
},

addFixtures: function(jsonArray) {
Expand Down
1 change: 1 addition & 0 deletions app/routes/marketplaces/apply.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Balanced.MarketplacesApplyRoute = Balanced.Route.extend({
};

models.marketplace.save(settings).then(function(marketplace) {

// associate to login
var userMarketplaceAssociation = Balanced.UserMarketplace.create({
uri: user.api_keys_uri,
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ module.exports = function(config) {
// - IE (only Windows)

// TravisCI only has Firefox and PhantomJS
browsers: ['PhantomJS'],
browsers: ['Firefox'],

// If browser does not capture in given timeout [ms], kill it
captureTimeout: 60000,
Expand Down
68 changes: 34 additions & 34 deletions test/integration/activity.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,19 +70,19 @@ test('add funds', function(assert) {
assert.equal($('.activity-escrow-box .amount .number1d').text().trim(), '$400.00', 'escrow amount is $400.00');

click('.activity-escrow-box .btn:eq(0)')
.then(function() {
assert.equal($('#add-funds').css('display'), 'block', 'add funds modal visible');
assert.equal($('#add-funds select option').length, 1, 'bank accounts in account dropdown');
})
.fillIn('#add-funds input', '55.55')
.fillIn('#add-funds input.description', 'Adding lots of money yo')
.click('#add-funds .modal-footer button[name="modal-submit"]')
.then(function() {
assert.ok(spy.calledOnce);
assert.ok(spy.calledWith(Balanced.Debit, '/customers/' + Balanced.TEST.CUSTOMER_ID + '/debits'));
assert.equal(spy.getCall(0).args[2].amount, 5555);
assert.equal(spy.getCall(0).args[2].description, 'Adding lots of money yo');
});
.then(function() {
assert.equal($('#add-funds').css('display'), 'block', 'add funds modal visible');
assert.equal($('#add-funds select option').length, 1, 'bank accounts in account dropdown');
})
.fillIn('#add-funds input', '55.55')
.fillIn('#add-funds input.description', 'Adding lots of money yo')
.click('#add-funds .modal-footer button[name="modal-submit"]')
.then(function() {
assert.ok(spy.calledOnce);
assert.ok(spy.calledWith(Balanced.Debit, '/customers/' + Balanced.TEST.CUSTOMER_ID + '/debits'));
assert.equal(spy.getCall(0).args[2].amount, 5555);
assert.equal(spy.getCall(0).args[2].description, 'Adding lots of money yo');
});
});
});
});
Expand Down Expand Up @@ -113,19 +113,19 @@ test('withdraw funds', function(assert) {
assert.equal($('.activity-escrow-box .amount .number1d').text().trim(), '$400.00', 'escrow amount is $400.00');

click('.activity-escrow-box .btn:eq(1)')
.then(function() {
assert.equal($('#withdraw-funds').css('display'), 'block', 'withdraw funds modal visible');
assert.equal($('#withdraw-funds select option').length, 1, 'bank accounts in account dropdown');
})
.fillIn('#withdraw-funds input', '55.55')
.fillIn('#withdraw-funds input.description', 'Withdrawing some monies')
.click('#withdraw-funds .modal-footer button[name="modal-submit"]')
.then(function() {
assert.ok(spy.calledOnce);
assert.ok(spy.calledWith(Balanced.Credit, '/customers/' + Balanced.TEST.CUSTOMER_ID + '/credits'));
assert.equal(spy.getCall(0).args[2].amount, 5555);
assert.equal(spy.getCall(0).args[2].description, 'Withdrawing some monies');
});
.then(function() {
assert.equal($('#withdraw-funds').css('display'), 'block', 'withdraw funds modal visible');
assert.equal($('#withdraw-funds select option').length, 1, 'bank accounts in account dropdown');
})
.fillIn('#withdraw-funds input', '55.55')
.fillIn('#withdraw-funds input.description', 'Withdrawing some monies')
.click('#withdraw-funds .modal-footer button[name="modal-submit"]')
.then(function() {
assert.ok(spy.calledOnce);
assert.ok(spy.calledWith(Balanced.Credit, '/customers/' + Balanced.TEST.CUSTOMER_ID + '/credits'));
assert.equal(spy.getCall(0).args[2].amount, 5555);
assert.equal(spy.getCall(0).args[2].description, 'Withdrawing some monies');
});
});
});
});
Expand All @@ -139,14 +139,14 @@ test('withdraw funds only withdraws once despite multiple clicks', function(asse

Ember.run.next(function() {
click('.activity-escrow-box .btn:eq(1)')
.fillIn('#withdraw-funds input', '55.55')
.click('#withdraw-funds .modal-footer button[name="modal-submit"]')
.click('#withdraw-funds .modal-footer button[name="modal-submit"]')
.click('#withdraw-funds .modal-footer button[name="modal-submit"]')
.click('#withdraw-funds .modal-footer button[name="modal-submit"]')
.then(function() {
assert.ok(stub.calledOnce);
});
.fillIn('#withdraw-funds input', '55.55')
.click('#withdraw-funds .modal-footer button[name="modal-submit"]')
.click('#withdraw-funds .modal-footer button[name="modal-submit"]')
.click('#withdraw-funds .modal-footer button[name="modal-submit"]')
.click('#withdraw-funds .modal-footer button[name="modal-submit"]')
.then(function() {
assert.ok(stub.calledOnce);
});
});
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/integration/bank_account.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ test('can initiate bank account verification', function(assert) {
.click('#verify-bank-account .modal-footer button[name="modal-submit"]')
.then(function() {
assert.ok(stub.calledOnce);
assert.ok(stub.calledWith(Balanced.Verification, '/bank_accounts/' + Balanced.TEST.BANK_ACCOUNT_ID + '/bank_account_verifications'));
assert.ok(stub.calledWith(Balanced.Verification, '/bank_accounts/' + Balanced.TEST.BANK_ACCOUNT_ID + '/verifications'));
});
});
});
Expand Down
10 changes: 5 additions & 5 deletions test/integration/invoices.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,20 @@ module('Invoices', {
});

test('can visit page', function(assert) {
visit('/marketplaces/MP5m04ORxNlNDm1bB7nkcgSY/invoices').then(function() {
visit('/marketplaces/TEST-MP4cOZZqeAelhxXQzljLLtgl/invoices').then(function() {
// check the page title has been selected
assert.equal($('#content h1').text().trim(), 'Invoices');
});
});

test('shows invoices list', function(assert) {
visit('/marketplaces/MP5m04ORxNlNDm1bB7nkcgSY/invoices').then(function() {
visit('/marketplaces/TEST-MP4cOZZqeAelhxXQzljLLtgl/invoices').then(function() {
assert.equal($("#invoices table tbody tr").length, 2);
});
});

test('invoice detail page', function(assert) {
visit('/marketplaces/MP5m04ORxNlNDm1bB7nkcgSY/invoices/IVDOATjeyAPTJMJPnBR83uE')
visit('/marketplaces/TEST-MP4cOZZqeAelhxXQzljLLtgl/invoices/IVDOATjeyAPTJMJPnBR83uE')
.then(function() {
assert.equal($(".invoice-balance-due-box .amount").text().trim(), "$17.85");
assert.equal($(".hold-details-row .total").text().trim(), "$17.85");
Expand Down Expand Up @@ -59,7 +59,7 @@ test('invoice detail page', function(assert) {

// Check if the transaction is showing up correctly
assert.equal($('.activity table.transactions tbody tr:eq(0) .type').text().trim(), 'Hold: void');
assert.equal($('.activity table.transactions tbody tr:eq(0) .account').text().trim(), 'slkfdjslkj ([email protected])');
assert.equal($('.activity table.transactions tbody tr:eq(0) .account').text().trim(), 'slkfdjslkj');
assert.equal($('.activity table.transactions tbody tr:eq(0) .amount').text().trim(), '$49.95');
})
.click('.activity .results header li.debit-bank-accounts a')
Expand All @@ -76,7 +76,7 @@ test('invoice detail page', function(assert) {

// Check if the transaction is showing up correctly
assert.equal($('.activity table.transactions tbody tr:eq(0) .type').text().trim(), 'Refund');
assert.equal($('.activity table.transactions tbody tr:eq(0) .account').text().trim(), 'Marc Sherry ([email protected])');
assert.equal($('.activity table.transactions tbody tr:eq(0) .account').text().trim(), 'Marc Sherry');
assert.equal($('.activity table.transactions tbody tr:eq(0) .amount').text().trim(), '$5.00');
});
});
2 changes: 1 addition & 1 deletion test/integration/logs.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module('Logs', {
setup: function() {
Balanced.TEST.setupMarketplace();
var i = 3;
while(i > 0) {
while (i > 0) {
Ember.run(function() {
Balanced.Debit.create({
uri: '/customers/' + Balanced.TEST.CUSTOMER_ID + '/debits',
Expand Down
Loading

0 comments on commit 25497ea

Please sign in to comment.