Skip to content

Commit 69e7397

Browse files
committed
minor Batch improvements
1 parent 515e23f commit 69e7397

File tree

2 files changed

+25
-18
lines changed

2 files changed

+25
-18
lines changed

test/integration/BatchSpec.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { testingApiClient, startNockRec } from "./helpers/integrationTestsHelper
33
import { BatchFactory } from "./factories/BatchFactory";
44
import { RecipientFactory } from "./factories/RecipientFactory";
55
import { RecipientAccountFactory } from "./factories/RecipientAccountFactory";
6+
import { Batch } from "../../lib";
67

78
let batchFactory: BatchFactory;
89
let recipientFactory: RecipientFactory;
@@ -33,6 +34,9 @@ describe("Batch", () => {
3334
assert.ok(batch);
3435
assert.ok(batch.id);
3536
assert.ok(all.length > 0);
37+
38+
assert.strictEqual(batch.constructor, Batch);
39+
assert.strictEqual(batch.description, batchFactory.defaultAttrs.description);
3640
});
3741

3842
it("updates a batch", async () => {
@@ -50,6 +54,8 @@ describe("Batch", () => {
5054
nockDone();
5155

5256
assert.ok(batch);
57+
58+
assert.strictEqual(batch.constructor, Batch);
5359
assert.strictEqual(batch.description, "Integration Test Update 2");
5460
assert.strictEqual(batch.status, "open");
5561
});
@@ -81,6 +87,8 @@ describe("Batch", () => {
8187
assert.ok(batch);
8288
assert.ok(batch.id);
8389
assert.ok(findBatch);
90+
91+
assert.strictEqual(batch.constructor, Batch);
8492
assert.strictEqual(batch.totalPayments, 2);
8593

8694
const payments = await testingApiClient.batch.paymentList(batch.id);
@@ -120,7 +128,6 @@ describe("Batch", () => {
120128

121129
assert.ok(batch);
122130
assert.ok(batch.id);
123-
assert.strictEqual(2, summary.detail["bank-transfer"].count, "Bad Count");
124131
assert.ok(quote, "failed to get quote");
125132
assert.ok(start, "Failed to start");
126133
});
Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import {ApiFactory} from "./ApiFactory";
2-
3-
export class BatchFactory extends ApiFactory {
4-
private defaultAttrs = {
5-
sourceCurrency: "USD",
6-
description: "Integration Test Create"
7-
}
8-
9-
public async createResource(attrs: any = {}) {
10-
const payments = attrs.payments || [];
11-
12-
return await this.apiClient.batch.create({
13-
...this.defaultAttrs,
14-
...attrs
15-
}, payments);
16-
}
17-
}
1+
import { ApiFactory } from "./ApiFactory";
2+
3+
export class BatchFactory extends ApiFactory {
4+
defaultAttrs = {
5+
sourceCurrency: "USD",
6+
description: "Integration Test Create",
7+
};
8+
9+
public async createResource(attrs: any = {}) {
10+
const payments = attrs.payments || [];
11+
12+
return this.apiClient.batch.create({
13+
...this.defaultAttrs,
14+
...attrs,
15+
}, payments);
16+
}
17+
}

0 commit comments

Comments
 (0)