-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
71 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,10 @@ import { Paystack } from "./paystack" | |
|
||
|
||
const paystack = mock(() => new Paystack(import.meta.env.PAYSTACK_SECRET_KEY ?? "")) | ||
// const customer = mock(async () => await paystack().customer.create({ email: "[email protected]" })) | ||
const product = mock(async () => await paystack().product.create({ | ||
name: "mithril", description: "a rare and mythical item", price: 9999999999, currency: "NGN" | ||
}) | ||
) | ||
// const blacklist_customer = mock(async () => await paystack().customer.create({ email: "[email protected]" })) | ||
|
||
test("create product", async () => { | ||
|
@@ -25,3 +28,17 @@ test("list products", async () => { | |
expect(response.meta.perPage).toBe(10) | ||
} | ||
}) | ||
|
||
test("fetch a product", async () => { | ||
const pro = await product() | ||
expect(pro.status).toBe(true) | ||
if (pro.status) { | ||
let response = await paystack().product.fetch(pro.data.id) | ||
expect(response.status).toBe(true) | ||
if (response.status) { | ||
expect(response.data.id).toBe(pro.data.id) | ||
expect(response.data.name).toBe(pro.data.name) | ||
expect(response.data.description).toBe(pro.data.description) | ||
} | ||
} | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters