Skip to content

Commit

Permalink
Update subscriptions tests to pass with new API changes
Browse files Browse the repository at this point in the history
Version 2018-02-05 came with a major change to plans and products:

* Products now have a `type` which is `service` or `good`.
* Plans have `name` change to `nickname`.
* Plans now take a product (of `type=service`) on creation.
  • Loading branch information
brandur committed Feb 13, 2018
1 parent ab9fbfb commit 0c1973d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 4 deletions.
20 changes: 16 additions & 4 deletions test/flows.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ describe('Flows', function() {
amount: 1700,
currency: CURRENCY,
interval: 'month',
name: 'Gold Super Amazing Tier',
nickname: 'Gold Super Amazing Tier',
product: {
name: 'product' + testUtils.getRandomString(),
},
}),
stripe.customers.create(CUSTOMER_DETAILS)
).then(function(j) {
Expand Down Expand Up @@ -71,7 +74,10 @@ describe('Flows', function() {
amount: 1700,
currency: CURRENCY,
interval: 'month',
name: 'Gold Super Amazing Tier',
nickname: 'Gold Super Amazing Tier',
product: {
name: 'product' + testUtils.getRandomString(),
},
}),
stripe.customers.create(CUSTOMER_DETAILS)
).then(function(j) {
Expand Down Expand Up @@ -122,7 +128,10 @@ describe('Flows', function() {
amount: 1700,
currency: CURRENCY,
interval: 'month',
name: 'Silver Super Amazing Tier',
nickname: 'Silver Super Amazing Tier',
product: {
name: 'product' + testUtils.getRandomString(),
},
}),
stripe.customers.create(CUSTOMER_DETAILS)
).then(function(j) {
Expand Down Expand Up @@ -157,7 +166,10 @@ describe('Flows', function() {
amount: 1700,
currency: CURRENCY,
interval: 'month',
name: 'generic',
nickname: 'generic',
product: {
name: 'product' + testUtils.getRandomString(),
},
}).then(function() {
cleanup.deletePlan(planID);
return stripe.plans.retrieve(planID);
Expand Down
2 changes: 2 additions & 0 deletions test/resources/Products.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ describe('Product Resource', function() {
stripe.products.create({
name: 'Llamas',
active: true,
type: 'good',
});
expect(stripe.LAST_REQUEST).to.deep.equal({
method: 'POST',
url: '/v1/products',
data: {
name: 'Llamas',
active: true,
type: 'good',
},
headers: {},
});
Expand Down

0 comments on commit 0c1973d

Please sign in to comment.