Skip to content
This repository has been archived by the owner on Dec 11, 2022. It is now read-only.

Commit

Permalink
Release 0.0.9
Browse files Browse the repository at this point in the history
- Accounts can be created with a specified ID
  • Loading branch information
jeff committed Sep 30, 2019
1 parent a29a323 commit 747e4fd
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stripe-stateful-mock",
"version": "0.0.8",
"version": "0.0.9",
"description": "A half-baked, stateful Stripe mock server",
"main": "dist/index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/api/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export namespace accounts {
});
}

const connectedAccountId = `acct_${generateId(16)}`;
const connectedAccountId = (params as any).id || `acct_${generateId(16)}`;
const now = new Date();
const account: stripe.accounts.IAccount & any = { // The d.ts is out of date on this object and I don't want to bother.
id: connectedAccountId,
Expand Down
12 changes: 12 additions & 0 deletions test/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,18 @@ describe("accounts", () => {
chai.assert.equal(getError.type, "StripePermissionError");
});

it("can create an account with a specific ID", async () => {
const accountReq: any = {
type: "standard",
id: generateId() // This does not work in the live server.
};
const account = await localStripeClient.accounts.create(accountReq);
chai.assert.equal(account.id, accountReq.id);

const getAccount = await localStripeClient.accounts.retrieve(account.id);
chai.assert.deepEqual(getAccount, account);
});

it("cannot create an account from a connect account", async () => {
const account = await localStripeClient.accounts.create({type: "standard"});
chai.assert.isString(account.id);
Expand Down

0 comments on commit 747e4fd

Please sign in to comment.