|
| 1 | +'use strict'; |
| 2 | + |
| 3 | +var stripe = require('../testUtils').getSpyableStripe(); |
| 4 | +var expect = require('chai').expect; |
| 5 | + |
| 6 | +describe('Topup Resource', function() { |
| 7 | + describe('retrieve', function() { |
| 8 | + it('Sends the correct request', function() { |
| 9 | + stripe.topups.retrieve('tu_123'); |
| 10 | + expect(stripe.LAST_REQUEST).to.deep.equal({ |
| 11 | + method: 'GET', |
| 12 | + url: '/v1/topups/tu_123', |
| 13 | + data: {}, |
| 14 | + headers: {}, |
| 15 | + }); |
| 16 | + }); |
| 17 | + }); |
| 18 | + |
| 19 | + describe('create', function() { |
| 20 | + it('Sends the correct request', function() { |
| 21 | + stripe.topups.create({ |
| 22 | + source: 'src_123', |
| 23 | + amount: '1500', |
| 24 | + currency: 'usd', |
| 25 | + description: 'a topup', |
| 26 | + statement_descriptor: 'creating a topup', |
| 27 | + }); |
| 28 | + expect(stripe.LAST_REQUEST).to.deep.equal({ |
| 29 | + method: 'POST', |
| 30 | + url: '/v1/topups', |
| 31 | + data: { |
| 32 | + source: 'src_123', |
| 33 | + amount: '1500', |
| 34 | + currency: 'usd', |
| 35 | + description: 'a topup', |
| 36 | + statement_descriptor: 'creating a topup', |
| 37 | + }, |
| 38 | + headers: {}, |
| 39 | + }); |
| 40 | + }); |
| 41 | + }); |
| 42 | + |
| 43 | + describe('list', function() { |
| 44 | + it('Sends the correct request', function() { |
| 45 | + stripe.topups.list(); |
| 46 | + expect(stripe.LAST_REQUEST).to.deep.equal({ |
| 47 | + method: 'GET', |
| 48 | + url: '/v1/topups', |
| 49 | + data: {}, |
| 50 | + headers: {}, |
| 51 | + }); |
| 52 | + }); |
| 53 | + }); |
| 54 | + |
| 55 | + describe('update', function() { |
| 56 | + it('Sends the correct request', function() { |
| 57 | + stripe.topups.update('tu_123', {metadata: {'key': 'value'}}); |
| 58 | + expect(stripe.LAST_REQUEST).to.deep.equal({ |
| 59 | + method: 'POST', |
| 60 | + url: '/v1/topups/tu_123', |
| 61 | + headers: {}, |
| 62 | + data: {metadata: {'key': 'value'}}, |
| 63 | + }); |
| 64 | + }); |
| 65 | + }); |
| 66 | +}); |
0 commit comments