|
1 | 1 | import { ctpApiBuilder as ctpApiRoot } from '../helpers/ctp-api-helper' |
2 | | -import { ctpApiBuilder } from '../helpers/api-helpers' |
| 2 | +import { ctpApiBuilder, Transaction } from '../helpers/api-helpers' |
3 | 3 |
|
4 | 4 | describe('::transaction', () => { |
5 | | - let cart: any |
| 5 | + let cart: any, transactions: Transaction |
6 | 6 |
|
7 | 7 | afterAll(async () => { |
8 | 8 | const updatedCart = await ctpApiRoot |
@@ -31,7 +31,7 @@ describe('::transaction', () => { |
31 | 31 | }) |
32 | 32 |
|
33 | 33 | it('should create a transaction using created cart', async () => { |
34 | | - const transactions = await ctpApiBuilder |
| 34 | + const _transactions = await ctpApiBuilder |
35 | 35 | .transactions() |
36 | 36 | .post({ |
37 | 37 | body: { |
@@ -59,7 +59,19 @@ describe('::transaction', () => { |
59 | 59 | }) |
60 | 60 | .execute() |
61 | 61 |
|
62 | | - expect(transactions).toBeDefined() |
63 | | - expect(transactions.statusCode).toEqual(201) |
| 62 | + expect(_transactions).toBeDefined() |
| 63 | + expect(_transactions.statusCode).toEqual(201) |
| 64 | + transactions = _transactions.body |
| 65 | + }) |
| 66 | + |
| 67 | + it('should retrieve a transaction using ID', async () => { |
| 68 | + const _transaction = await ctpApiBuilder |
| 69 | + .transactions() |
| 70 | + .withId({ id: transactions.id }) |
| 71 | + .get() |
| 72 | + .execute() |
| 73 | + |
| 74 | + expect(_transaction).toBeDefined() |
| 75 | + expect(_transaction.statusCode).toEqual(200) |
64 | 76 | }) |
65 | 77 | }) |
0 commit comments