Commit 47ebe5c6 authored by hrzaa's avatar hrzaa
Browse files

update test

parent 49f5fd22
Showing with 147 additions and 184 deletions
+147 -184
......@@ -16,7 +16,7 @@
"joi": "^17.12.3",
"jsonwebtoken": "^9.0.2",
"midtrans-client": "^1.3.1",
"nanoid": "^5.0.7",
"nanoid": "^3.3.7",
"uuid": "^9.0.1",
"winston": "^3.13.0"
},
......@@ -2564,9 +2564,9 @@
}
},
"node_modules/@prisma/client": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.15.0.tgz",
"integrity": "sha512-wPTeTjbd2Q0abOeffN7zCDCbkp9C9cF+e9HPiI64lmpehyq2TepgXE+sY7FXr7Rhbb21prLMnhXX27/E11V09w==",
"version": "5.15.1",
"resolved": "https://registry.npmjs.org/@prisma/client/-/client-5.15.1.tgz",
"integrity": "sha512-fmZRGmsUJ9+VwC/AvfP/PwdpD0xAEyPvNsD9/B3+GYpETq9VejVRT3PiqNvl76q1uYYzNZeo8u/LmzzTetHSEg==",
"hasInstallScript": true,
"engines": {
"node": ">=16.13"
......@@ -2581,48 +2581,48 @@
}
},
"node_modules/@prisma/debug": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.15.0.tgz",
"integrity": "sha512-QpEAOjieLPc/4sMny/WrWqtpIAmBYsgqwWlWwIctqZO0AbhQ9QcT6x2Ut3ojbDo/pFRCCA1Z1+xm2MUy7fAkZA==",
"version": "5.15.1",
"resolved": "https://registry.npmjs.org/@prisma/debug/-/debug-5.15.1.tgz",
"integrity": "sha512-NQjdEplhXEcPvf84ghxExC+LD+iTimbg3sZvA3BhybVQIocBEBxFf9GTHhmRVPmjrWoBaYJBVgEEBXZT27JTbQ==",
"devOptional": true
},
"node_modules/@prisma/engines": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.15.0.tgz",
"integrity": "sha512-hXL5Sn9hh/ZpRKWiyPA5GbvF3laqBHKt6Vo70hYqqOhh5e0ZXDzHcdmxNvOefEFeqxra2DMz2hNbFoPvqrVe1w==",
"version": "5.15.1",
"resolved": "https://registry.npmjs.org/@prisma/engines/-/engines-5.15.1.tgz",
"integrity": "sha512-1iTRxJEFvpBpEWf2bYiMG6LBBQhX7X+GA5piH+tmPWgc/v+/ElxQf2kjQxby8AErmZqtZkdoKJ7FSRjNjBPE9Q==",
"devOptional": true,
"hasInstallScript": true,
"dependencies": {
"@prisma/debug": "5.15.0",
"@prisma/engines-version": "5.15.0-29.12e25d8d06f6ea5a0252864dd9a03b1bb51f3022",
"@prisma/fetch-engine": "5.15.0",
"@prisma/get-platform": "5.15.0"
"@prisma/debug": "5.15.1",
"@prisma/engines-version": "5.15.1-1.5675a3182f972f1a8f31d16eee6abf4fd54910e3",
"@prisma/fetch-engine": "5.15.1",
"@prisma/get-platform": "5.15.1"
}
},
"node_modules/@prisma/engines-version": {
"version": "5.15.0-29.12e25d8d06f6ea5a0252864dd9a03b1bb51f3022",
"resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.15.0-29.12e25d8d06f6ea5a0252864dd9a03b1bb51f3022.tgz",
"integrity": "sha512-3BEgZ41Qb4oWHz9kZNofToRvNeS4LZYaT9pienR1gWkjhky6t6K1NyeWNBkqSj2llgraUNbgMOCQPY4f7Qp5wA==",
"version": "5.15.1-1.5675a3182f972f1a8f31d16eee6abf4fd54910e3",
"resolved": "https://registry.npmjs.org/@prisma/engines-version/-/engines-version-5.15.1-1.5675a3182f972f1a8f31d16eee6abf4fd54910e3.tgz",
"integrity": "sha512-7csphKGCG6n/cN1MkT1mJvQ78Ir18IknlYZ8eyEoLKdQBb0HscR/6TyPmzqrMA7Rz01K1KeXqctwAqxtA/lKQg==",
"devOptional": true
},
"node_modules/@prisma/fetch-engine": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.15.0.tgz",
"integrity": "sha512-z6AY5yyXxc20Klj7wwnfGP0iIUkVKzybqapT02zLYR/nf9ynaeN8bq73WRmi1TkLYn+DJ5Qy+JGu7hBf1pE78A==",
"version": "5.15.1",
"resolved": "https://registry.npmjs.org/@prisma/fetch-engine/-/fetch-engine-5.15.1.tgz",
"integrity": "sha512-mj0wfsJ+mAdDp1ynT2JKxAXa+CoYMT267qF7g2Uv+oaVTI2CMfGWouMARht8T2QLTgl+gpXSFTwIYbcR+oWEtw==",
"devOptional": true,
"dependencies": {
"@prisma/debug": "5.15.0",
"@prisma/engines-version": "5.15.0-29.12e25d8d06f6ea5a0252864dd9a03b1bb51f3022",
"@prisma/get-platform": "5.15.0"
"@prisma/debug": "5.15.1",
"@prisma/engines-version": "5.15.1-1.5675a3182f972f1a8f31d16eee6abf4fd54910e3",
"@prisma/get-platform": "5.15.1"
}
},
"node_modules/@prisma/get-platform": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.15.0.tgz",
"integrity": "sha512-1GULDkW4+/VQb73vihxCBSc4Chc2x88MA+O40tcZFjmBzG4/fF44PaXFxUqKSFltxU9L9GIMLhh0Gfkk/pUbtg==",
"version": "5.15.1",
"resolved": "https://registry.npmjs.org/@prisma/get-platform/-/get-platform-5.15.1.tgz",
"integrity": "sha512-oFccp7bYys+ZYkmtYzjR+0cRrGKvSuF+h5QhSkyEsYQ9kzJzQRvuWt2SiHRPt8xOQ4MTmujM+bP5uOexnnAHdQ==",
"devOptional": true,
"dependencies": {
"@prisma/debug": "5.15.0"
"@prisma/debug": "5.15.1"
}
},
"node_modules/@sideway/address": {
......@@ -2755,9 +2755,9 @@
}
},
"node_modules/@types/express-serve-static-core": {
"version": "4.19.3",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.3.tgz",
"integrity": "sha512-KOzM7MhcBFlmnlr/fzISFF5vGWVSvN6fTd4T+ExOt08bA/dA5kpSzY52nMsI1KDFmUREpJelPYyuslLRSjjgCg==",
"version": "4.19.5",
"resolved": "https://registry.npmjs.org/@types/express-serve-static-core/-/express-serve-static-core-4.19.5.tgz",
"integrity": "sha512-y6W03tvrACO72aijJ5uF02FRq5cgDR9lUxddQ8vyF+GvmjJQqbzDcJngEjURc+ZsG31VI3hODNZJ2URj86pzmg==",
"dev": true,
"dependencies": {
"@types/node": "*",
......@@ -2828,9 +2828,9 @@
"dev": true
},
"node_modules/@types/node": {
"version": "20.14.2",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.2.tgz",
"integrity": "sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q==",
"version": "20.14.8",
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.14.8.tgz",
"integrity": "sha512-DO+2/jZinXfROG7j7WKFn/3C6nFwxy2lLpgLjEXJz+0XKphZlTLJ14mo8Vfg8X5BWN6XjyESXq+LcYdT7tR3bA==",
"dev": true,
"dependencies": {
"undici-types": "~5.26.4"
......@@ -3427,9 +3427,9 @@
}
},
"node_modules/caniuse-lite": {
"version": "1.0.30001632",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001632.tgz",
"integrity": "sha512-udx3o7yHJfUxMLkGohMlVHCvFvWmirKh9JAH/d7WOLPetlH+LTL5cocMZ0t7oZx/mdlOWXti97xLZWc8uURRHg==",
"version": "1.0.30001636",
"resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001636.tgz",
"integrity": "sha512-bMg2vmr8XBsbL6Lr0UHXy/21m84FTxDLWn2FSqMd5PrlbMxwJlQnC2YWYxVgp66PZE+BBNF2jYQUBKCo1FDeZg==",
"dev": true,
"funding": [
{
......@@ -3917,9 +3917,9 @@
"integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow=="
},
"node_modules/electron-to-chromium": {
"version": "1.4.798",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.798.tgz",
"integrity": "sha512-by9J2CiM9KPGj9qfp5U4FcPSbXJG7FNzqnYaY4WLzX+v2PHieVGmnsA4dxfpGE3QEC7JofpPZmn7Vn1B9NR2+Q==",
"version": "1.4.810",
"resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.810.tgz",
"integrity": "sha512-Kaxhu4T7SJGpRQx99tq216gCq2nMxJo+uuT6uzz9l8TVN2stL7M06MIIXAtr9jsrLs2Glflgf2vMQRepxawOdQ==",
"dev": true
},
"node_modules/emittery": {
......@@ -4640,12 +4640,15 @@
"dev": true
},
"node_modules/is-core-module": {
"version": "2.13.1",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.1.tgz",
"integrity": "sha512-hHrIjvZsftOsvKSn2TRYl63zvxsgE0K+0mYMoH6gD4omR5IWB2KynivBQczo3+wF1cCkjzvptnI9Q0sPU66ilw==",
"version": "2.14.0",
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.14.0.tgz",
"integrity": "sha512-a5dFJih5ZLYlRtDc0dZWP7RiKr6xIKzmn/oAYCDvdLThadVgyJwlaoQPmRtMSpz+rk0OGAgIu+TcM9HUF0fk1A==",
"dev": true,
"dependencies": {
"hasown": "^2.0.0"
"hasown": "^2.0.2"
},
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
......@@ -6365,9 +6368,9 @@
}
},
"node_modules/joi": {
"version": "17.13.1",
"resolved": "https://registry.npmjs.org/joi/-/joi-17.13.1.tgz",
"integrity": "sha512-vaBlIKCyo4FCUtCm7Eu4QZd/q02bWcxfUO6YSXAZOWF6gzcLBeba8kwotUdYJjDLW8Cz8RywsSOqiNJZW0mNvg==",
"version": "17.13.3",
"resolved": "https://registry.npmjs.org/joi/-/joi-17.13.3.tgz",
"integrity": "sha512-otDA4ldcIx+ZXsKHWmp0YizCweVRZG96J10b0FevjfuncLO1oX59THoAmHkNubYJ+9gWsYsp5k8v4ib6oDv1fA==",
"dependencies": {
"@hapi/hoek": "^9.3.0",
"@hapi/topo": "^5.1.0",
......@@ -6763,9 +6766,9 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/nanoid": {
"version": "5.0.7",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-5.0.7.tgz",
"integrity": "sha512-oLxFY2gd2IqnjcYyOXD8XGCftpGtZP2AbHbOkthDkvRywH5ayNtPVy9YlOPcHckXzbLTCHpkb7FB+yuxKV13pQ==",
"version": "3.3.7",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz",
"integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==",
"funding": [
{
"type": "github",
......@@ -6773,10 +6776,10 @@
}
],
"bin": {
"nanoid": "bin/nanoid.js"
"nanoid": "bin/nanoid.cjs"
},
"engines": {
"node": "^18 || >=20"
"node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1"
}
},
"node_modules/natural-compare": {
......@@ -6885,9 +6888,12 @@
}
},
"node_modules/object-inspect": {
"version": "1.13.1",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.1.tgz",
"integrity": "sha512-5qoj1RUiKOMsCCNLV1CBiPYE10sziTsnmNxkAI/rZhiD63CF7IqdFGC/XzjWjpSgLf0LxXX3bDFIh0E18f6UhQ==",
"version": "1.13.2",
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.2.tgz",
"integrity": "sha512-IRZSRuzJiynemAXPYtPe5BoI/RESNYR7TYm50MC5Mqbd3Jmw5y790sErYw3V6SryFJD64b74qQQs9wn5Bg/k3g==",
"engines": {
"node": ">= 0.4"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
......@@ -7114,13 +7120,13 @@
}
},
"node_modules/prisma": {
"version": "5.15.0",
"resolved": "https://registry.npmjs.org/prisma/-/prisma-5.15.0.tgz",
"integrity": "sha512-JA81ACQSCi3a7NUOgonOIkdx8PAVkO+HbUOxmd00Yb8DgIIEpr2V9+Qe/j6MLxIgWtE/OtVQ54rVjfYRbZsCfw==",
"version": "5.15.1",
"resolved": "https://registry.npmjs.org/prisma/-/prisma-5.15.1.tgz",
"integrity": "sha512-pYsUVpTlYvZ6mWvZKDv9rKdUa7tlfSUJY1CVtgb8Had1pHbIm9fr1MBASccr5XnSuCUrjnvKhWNwgSYy6aCajA==",
"devOptional": true,
"hasInstallScript": true,
"dependencies": {
"@prisma/engines": "5.15.0"
"@prisma/engines": "5.15.1"
},
"bin": {
"prisma": "build/index.js"
......@@ -8010,9 +8016,9 @@
}
},
"node_modules/v8-to-istanbul": {
"version": "9.2.0",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.2.0.tgz",
"integrity": "sha512-/EH/sDgxU2eGxajKdwLCDmQ4FWq+kpi3uCmBGpw1xJtnAxEjlD8j8PEiGWpCIMIs3ciNAgH0d3TTJiUkYzyZjA==",
"version": "9.3.0",
"resolved": "https://registry.npmjs.org/v8-to-istanbul/-/v8-to-istanbul-9.3.0.tgz",
"integrity": "sha512-kiGUalWN+rgBJ/1OHZsBtU4rXZOfj/7rKQxULKlIzwzQSvMJUUNgPwJEEh7gU6xEVxC0ahoOBvN2YI8GH6FNgA==",
"dev": true,
"dependencies": {
"@jridgewell/trace-mapping": "^0.3.12",
......
......@@ -22,7 +22,7 @@
"joi": "^17.12.3",
"jsonwebtoken": "^9.0.2",
"midtrans-client": "^1.3.1",
"nanoid": "^5.0.7",
"nanoid": "^3.3.7",
"uuid": "^9.0.1",
"winston": "^3.13.0"
},
......
/*
Warnings:
- You are about to drop the `areas` table. If the table is not empty, all the data it contains will be lost.
- You are about to drop the `main_areas` table. If the table is not empty, all the data it contains will be lost.
*/
-- DropForeignKey
ALTER TABLE `areas` DROP FOREIGN KEY `areas_mainAreaId_fkey`;
-- DropTable
DROP TABLE `areas`;
-- DropTable
DROP TABLE `main_areas`;
-- CreateTable
CREATE TABLE `parking_areas` (
`id` VARCHAR(191) NOT NULL,
`parking_name` VARCHAR(191) NOT NULL,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME(3) NOT NULL,
UNIQUE INDEX `parking_areas_parking_name_key`(`parking_name`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- CreateTable
CREATE TABLE `parking_spaces` (
`id` VARCHAR(191) NOT NULL,
`parkingAreaId` VARCHAR(191) NOT NULL,
`space_name` VARCHAR(191) NOT NULL,
`status` BOOLEAN NOT NULL DEFAULT false,
`createdAt` DATETIME(3) NOT NULL DEFAULT CURRENT_TIMESTAMP(3),
`updatedAt` DATETIME(3) NOT NULL,
UNIQUE INDEX `parking_spaces_space_name_key`(`space_name`),
PRIMARY KEY (`id`)
) DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
-- AddForeignKey
ALTER TABLE `parking_spaces` ADD CONSTRAINT `parking_spaces_parkingAreaId_fkey` FOREIGN KEY (`parkingAreaId`) REFERENCES `parking_areas`(`id`) ON DELETE CASCADE ON UPDATE CASCADE;
......@@ -15,7 +15,6 @@ const parkingIn = async (req, res, next) => {
const parkingOut = async (req, res, next) => {
try {
const parking = req.body;
// const transaction = req.params;
const result = await parkingService.parkingOut(parking);
res.status(200).json({
data: result,
......
......@@ -13,10 +13,15 @@ const create = async (req, res, next) => {
const update = async (req, res, next) => {
try {
const data = req.body;
const id = req.params;
const { priceId } = req.params; // Extract priceId from URL parameters
const { price } = req.body; // Extract price from request body
const result = await priceService.update(id, data);
// Validate the input
if (!priceId || price === undefined) {
throw new ResponseError(400, "Invalid priceId or price");
}
const result = await priceService.update({ priceId }, { price });
res.status(200).json({
data: result,
});
......
import jwt from "jsonwebtoken";
import { prismaClient } from "../application/database.js";
export const authMiddleware = async (req, res, next) => {
try {
......
......@@ -241,117 +241,10 @@ const removeParking = async (parkingId) => {
});
};
// const callback = async (orderId, orderStatus) => {
// // Define status mapping based on the orderStatus
// let transactionStatus;
// switch (orderStatus) {
// case "settlement":
// transactionStatus = "PAID";
// break;
// case "pending":
// transactionStatus = "PENDING_PAYMENT";
// break;
// case "expire":
// case "cancel":
// case "deny":
// transactionStatus = "CANCELED";
// break;
// default:
// throw new Error(`Invalid order status: ${orderStatus}`);
// }
// // Update transaction status in the database
// const updatedTransaction = await prismaClient.transaction.update({
// where: { parkingId: orderId },
// data: { transactionstatus: transactionStatus },
// select: {
// transactionId: true,
// parkingId: true,
// totalprice: true,
// transactionstatus: true,
// },
// });
// // Return the updated order details
// return {
// orderId: updatedTransaction.parkingId,
// orderStatus: updatedTransaction.transactionstatus,
// };
// };
// const callback = async (orderId, orderStatus) => {
// return { orderId, orderStatus };
// };
// const callback = async (request) => {
// const serverKey = process.env.MIDTRANS_SERVER_KEY;
// // Concatenate order_id, status_code, and gross_amount
// const payload = `${request.order_id}${request.status_code}${request.gross_amount}${serverKey}`;
// // Compute SHA512 hash
// const hash = crypto.createHash("sha512").update(payload).digest("hex");
// // Compare the computed hash with the signature key from Midtrans
// if (hash === request.signature_key) {
// let updateData = {};
// if (
// request.transaction_status === "capture" ||
// request.transaction_status === "settlement"
// ) {
// updateData.transactionstatus = "PAID";
// } else if (request.transaction_status === "pending") {
// updateData.transactionstatus = "PENDING_PAYMENT";
// } else if (
// ["cancel", "expire", "deny"].includes(request.transaction_status)
// ) {
// updateData.transactionstatus = "CANCELED";
// }
// if (Object.keys(updateData).length > 0) {
// await prismaClient.transaction.update({
// where: {
// parkingId: request.order_id,
// },
// data: updateData,
// });
// }
// } else {
// throw new Error("Invalid signature");
// }
// };
// const getTransaction = async () => {
// // const { id } = request.params;
// const transaction = await prismaClient.transaction.findFirst({
// where:{
// transactionstatus: "PENDING_PAYMENT"
// },
// orderBy: {
// created_at: "desc",
// },
// });
// if (!transaction) {
// throw new ResponseError(404, `Transactions Code not found`);
// }
// return transaction;
// };
export default {
parkingIn,
parkingOut,
getAllParking,
getAllParkingById,
removeParking,
// getTransaction,
// callback,
};
......@@ -35,8 +35,6 @@ const sumPaidTransactions = async () => {
return totalPrice ?? 0; // Jika totalPrice undefined, kembalikan 0
};
const getTransactionById = async ({transactionId}) => {
const transaction = await prismaClient.transaction.findUnique({
where: {
......@@ -66,7 +64,7 @@ const updateTransactionStatus = async ({transactionId, transaction_status, payme
data: {
transactionstatus: transaction_status,
payment_method: payment_method,
updated_at: new Date(), // Optional but good practice
updated_at: new Date(),
},
});
......
......@@ -5,7 +5,6 @@ const createParkingValidation = Joi.object({
parkingin: Joi.date().iso().optional(),
parkingout: Joi.date().iso().optional(),
totaltime: Joi.number().optional(),
// status: Joi.string().max(10).required(),
});
const updateParkingValidation = Joi.object({
......
......@@ -15,8 +15,8 @@ describe("POST /api/parkings/in", function () {
});
expect(result.status).toBe(200);
expect(result.body.data.code).toBe("test");
expect(result.body.data.status).toBe("start");
expect(result.body.data.createParkingIn.code).toBe("TEST");
expect(result.body.data.createParkingIn.status).toBe("start");
});
});
......@@ -38,7 +38,7 @@ describe("POST /api/parkings/out", function () {
expect(response.status).toBe(200);
expect(response.body.data).toBeDefined();
expect(response.body.data.updatedParking.code).toBe("test");
expect(response.body.data.updatedParking.code).toBe("TEST");
expect(response.body.data.updatedParking.status).toBe("end");
});
......@@ -58,7 +58,6 @@ describe("POST /api/parkings/out", function () {
});
describe("GET /api/parkings", function (){
afterEach(async () => {
......
......@@ -27,6 +27,31 @@ describe("POST /api/price/create", function () {
});
});
describe("PATCH /api/price/update", function () {
afterEach(async () => {
await removeTestUser();
await removeTestPrice();
});
it("should update the price", async () => {
const user = await createTestUser();
const price = await createTestPrice();
const result = await supertest(web)
.patch(`/api/price/update/${price.priceId}`) // Use priceId from test price
.query({ apiKey: user.token })
.send({
price: 1000, // New price value
});
console.log("Update result:", result.body);
expect(result.status).toBe(200);
expect(result.body.data.price).toBe(1000); // Ensure this matches your API response structure
});
});
describe("GET /api/prices", function () {
......
......@@ -39,7 +39,6 @@ export const createTestPrice = async () => {
});
};
export const removeTestPrice = async () => {
await prismaClient.price.deleteMany({
where: {
......@@ -117,4 +116,3 @@ export const getTestParkings = async () => {
return parking;
};
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment