Skip to content

Commit

Permalink
feat: migrate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
a11rew committed Nov 10, 2024
1 parent 3864dad commit 46fe1de
Show file tree
Hide file tree
Showing 6 changed files with 268 additions and 383 deletions.
3 changes: 0 additions & 3 deletions packages/plugin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@
"devDependencies": {
"@medusajs/framework": "^2.0.1",
"@medusajs/types": "^2.0.1",
"@types/express": "^4.17.21",
"@types/jest": "^29.5.12",
"@types/node": "^16.18.39",
"cross-env": "^5.2.1",
"eslint": "^8.57.0",
"eslint-config-airbnb-base": "15.0.0",
"eslint-config-prettier": "^9.1.0",
Expand All @@ -33,7 +31,6 @@
"prettier": "^3.2.5",
"rimraf": "^5.0.5",
"ts-jest": "^29.1.1",
"typeorm": "^0.3.20",
"typescript": "^5.4.4"
},
"scripts": {
Expand Down
16 changes: 0 additions & 16 deletions packages/plugin/src/__mocks__/cart.ts

This file was deleted.

16 changes: 15 additions & 1 deletion packages/plugin/src/lib/__mocks__/paystack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,21 @@ const handlers = [
}),

// Initialize transaction
http.post(`${PAYSTACK_API_PATH}/transaction/initialize`, () => {
http.post(`${PAYSTACK_API_PATH}/transaction/initialize`, async req => {
const { amount } = (await req.request.json()) as {
amount: number;
};

if (typeof amount !== "number") {
return HttpResponse.json(
{
status: false,
message: "Invalid amount",
},
{ status: 400 },
);
}

return HttpResponse.json({
status: true,
message: "Transaction initialized",
Expand Down
Loading

0 comments on commit 46fe1de

Please sign in to comment.