{"id":26057609,"url":"https://github.com/xriot45/express-js-cli","last_synced_at":"2025-04-11T04:51:00.236Z","repository":{"id":277480409,"uuid":"932554419","full_name":"xRiot45/express-js-cli","owner":"xRiot45","description":"Express JS CLI is a Command Line Interface (CLI) tool designed to make it easier and faster to create RESTful API projects using Express JS Framework.","archived":false,"fork":false,"pushed_at":"2025-03-12T15:09:51.000Z","size":7950,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T02:51:34.627Z","etag":null,"topics":["cli","commit-lint","expressjs","husky","javascript","layered-architecture","node-js","npm","rest-api","typescript","unit-testing"],"latest_commit_sha":null,"homepage":"https://express-js-cli.vercel.app","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xRiot45.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["xRiot45"]}},"created_at":"2025-02-14T05:15:44.000Z","updated_at":"2025-03-24T14:24:38.000Z","dependencies_parsed_at":"2025-03-07T03:38:12.850Z","dependency_job_id":null,"html_url":"https://github.com/xRiot45/express-js-cli","commit_stats":null,"previous_names":["xriot45/express-cli","xriot45/express-js-cli"],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xRiot45%2Fexpress-js-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xRiot45%2Fexpress-js-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xRiot45%2Fexpress-js-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xRiot45%2Fexpress-js-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xRiot45","download_url":"https://codeload.github.com/xRiot45/express-js-cli/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248345289,"owners_count":21088243,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","commit-lint","expressjs","husky","javascript","layered-architecture","node-js","npm","rest-api","typescript","unit-testing"],"created_at":"2025-03-08T11:50:05.803Z","updated_at":"2025-04-11T04:51:00.218Z","avatar_url":"https://github.com/xRiot45.png","language":"JavaScript","funding_links":["https://github.com/sponsors/xRiot45"],"categories":[],"sub_categories":[],"readme":"![Image](https://github.com/user-attachments/assets/15de09d9-a9b7-4fb0-8921-20bd346d636a)\n\n\u003cbr /\u003e\n\n\u003cdiv align=\"center\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/node.js-339933?style=for-the-badge\u0026logo=Node.js\u0026logoColor=white\" alt=\"node.js\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/express.js-000000?style=for-the-badge\u0026logo=express\u0026logoColor=white\" alt=\"express.js\" /\u003e\n    \u003cimg src=\"https://img.shields.io/badge/JavaScript-F7DF1E?style=for-the-badge\u0026logo=javascript\u0026logoColor=black\" alt=\"javascript\" /\u003e\n\u003c/div\u003e\n\n\u003ch2 align=\"center\"\u003eExpress JS CLI\u003c/h2\u003e\n\n\u003cdiv align=\"center\"\u003e\nExpress API CLI is a Command Line Interface (CLI) tool designed to make it easier and faster to create RESTful API projects using Express JS.\n\u003c/div\u003e\n\n\u003cbr /\u003e\n\n- **Version :** v1.2.5\n- **Developer :** Thomas Alberto\n- **Released On :** February 2025\n- **Status :** Stable Release\n- **License :** ISC License\n\n\u003cbr /\u003e\n\n## 📋 Table of Contents\n\n1. 🤖 [Introduction](#-introduction)\n2. ⚙️ [Tech Stack](#-tech-stack)\n3. 🔋 [Features](#-features)\n4. 🤸 [Quick Start](#-quick-start)\n5. 📜 [CLI Usage](#-cli-usage)\n6. 🕸️ [Snippets](#-snippets)\n7. 🔗 [Links](#-links)\n8. 💰 [Donate](#-donate)\n\n\u003cbr /\u003e\n\n## 🤖 Introduction\n\n**Express API CLI** is a Command Line Interface (CLI) tool designed to make it easier and faster to create **RESTful API** projects using **Express JS**. With this CLI, developers can immediately create a neat project structure, install the necessary dependencies, and configure various key features according to user preferences without having to do time-consuming manual setup.\n\nExpress API CLI comes as a solution for developers who want to save time in the initialization stage of backend projects using Express.js. With support for programming language selection (JavaScript or TypeScript), database configuration (MySQL or PostgreSQL), as well as tools such as Prettier for code formatting and Husky \u0026 Commitlint for commit standardization, this CLI is designed so that developers can focus directly on developing business features without worrying about the initial technical setup.\n\nThis tool is perfect for beginners who want to start projects quickly as well as for development teams who want to maintain standards and consistency in their projects. With just a few simple commands, Express.js projects are ready to go with a structure that conforms to best practices.\n\n\u003cbr /\u003e\n\n## ⚙️ Tech Stack\n\n- **Node JS** : JavaScript runtime for the server.\n- **Express JS** : Minimalist framework for the backend.\n- **JavaScript** : Programming Language.\n\n\u003cbr /\u003e\n\n## 🔋 Features\n\n✅ **Multi-Language Support** : Choose between JavaScript or TypeScript.\n\n✅ **Database Support** : Choose between MySQL or PostgreSQL.\n\n✅ **ORM (Object Relational Mapping) Support** : For now using Sequelize ORM\n\n✅ **Prettier Integration** : Automatically organize code with Prettier.\n\n✅ **ESLint Integration** : Maintain code quality with static analysis.\n\n✅ **Commit Linter** : Comes with Husky \u0026 Commitlint.\n\n✅ **Automated Project Structure** : Generates ready-to-use project structure.\n\n✅ **Initialize Git Repository** : Automatically initializes the Git repository.\n\n✅ **Quick Installation** : All major and development dependencies are instantly installed.\n\n✅ **Testing Support** : Choose between Jest \u0026 Supertest or Mocha \u0026 Chai Framework Testing\n\n✅ **Import Alias Support** : Choose between importing aliases or not using import aliases\n\n\u003cbr /\u003e\n\n## 🤸 Quick Start\n\nFollow these steps to set up the project locally on your machine\n\n**1. Prerequisites**\n\nMake sure you have the following installed on your machine:\n\n- [Git](https://git-scm.com/)\n- [Node.js](https://nodejs.org/en)\n- [npm](https://www.npmjs.com/) (Node Package Manager)\n\n**2. Instalation**\n\n```bash\n$ npm install -g express-api-cli-tool\n```\n\n**3. Create new project**\n\n```bash\n$ express new \u003cproject-name\u003e\n```\n\n**4. Follow the instructions**\n\n- **Select language** : JavaScript / TypeScript\n- **Select database** : MySQL / PostgreSQL\n- **Select testing** : Jest / Mocha\n- **Use import alias for modules? (`@* (For TypeScript) and #* (For JavaScript) ` by default)?** : (Y/n)\n- **Use Eslint for code linting?** : Y / n\n- **Use Husky and Commit lint for commit linting?** : Y / n\n- **Initialize Git repository?** : Y / n\n\n**5. Running your project**\n\n```bash\n# Change directory to your project\n$ cd \u003cyour-project\u003e\n\n# Format the code before running the project (optional)\n$ npm run format\n\n# Running your project\n$ npm run dev\n```\n\n**6 Verify the Setup**\n\nTo ensure the server is running properly, open a browser and access:\n\n```\nhttp://localhost:3000\n```\n\nOr run the following command in the terminal:\n\n```bash\n$ curl http://localhost:3000\n```\n\nIf the server is running properly, you will see a response from your server.\n\n\u003cbr /\u003e\n\n## 📜 CLI Usage\n\n**To view the list of available commands, use the following command**\n\n```bash\n$ express -h\n```\n\n**Output:**\n\n```\nUsage: express [options] [command]\n\nOptions:\n  -v, --version                     Display the current version of express-cli\n  -i, --info                        Display information about express-cli\n  -h, --help                        display help for command\n\nCommands:\n  new \u003cproject-name\u003e                Create a new Express.js API project\n  generate \u003cschematic\u003e \u003cfile-name\u003e  Generate a new file based on a schematic\n  update                            Update express-cli to the latest version\n\nSchematics:\n  controller   Generate a new controller file\n  service      Generate a new service file\n  route        Generate a new route file\n  repository   Generate a new repository file\n  validation   Generate a new validation file\n  model        Generate a new model file\n  interface    Generate a new interface file (if using TypeScript)\n  types        Generate a new types file (if using TypeScript)\n  resources    Generate a new resources file (CRUD)\n  config       Generate a new config file\n  middleware   Generate a new middleware file\n  util         Generate a new util file\n  enum         Generate a new enum file\n  test         Generate a new test file\n```\n\n\u003cbr /\u003e\n\n## 🕸️ Snippets\n\n**Code Service**\n\n- JavaScript\n\n```javascript\nconst get = async () =\u003e {\n  // Implement your logic get data here\n  return [];\n};\n\nconst getById = async (id) =\u003e {\n  // Implement your logic get data by id here\n  return null;\n};\n\nconst create = async (data) =\u003e {\n  // Implement your logic create data here\n  return null;\n};\n\nconst update = async (id, data) =\u003e {\n  // Implement your logic update data here\n  return null;\n};\n\nconst remove = async (id) =\u003e {\n  // Implement your logic remove data here\n  return false;\n};\n\nexport default { get, getById, create, update, remove };\n```\n\n- TypeScript\n\n```typescript\nimport testInterface from '../interfaces/test.interface.ts';\n\nconst get = async (): Promise\u003ctestInterface[]\u003e =\u003e {\n  // Implement your logic to get data here\n  return [];\n};\n\nconst getById = async (id: string): Promise\u003ctestInterface | null\u003e =\u003e {\n  // Implement your logic to get data by id here\n  return null;\n};\n\nconst create = async (data: testInterface): Promise\u003ctestInterface\u003e =\u003e {\n  // Implement your logic to create data here\n  return data;\n};\n\nconst update = async (\n  id: string,\n  data: Partial\u003ctestInterface\u003e,\n): Promise\u003ctestInterface | null\u003e =\u003e {\n  // Implement your logic to update data here\n  return null;\n};\n\nconst remove = async (id: string): Promise\u003cboolean\u003e =\u003e {\n  // Implement your logic to remove data here\n  return false;\n};\n\nexport default { get, getById, create, update, remove };\n```\n\n**Code Controller**\n\n- JavaScript\n\n```javascript\nconst get = async (req, res, next) =\u003e {\n  try {\n    // Implement your logic get data here\n  } catch (error) {\n    next(error);\n  }\n};\n\nconst getById = async (req, res, next) =\u003e {\n  try {\n    // Implement your logic get data by id here\n  } catch (error) {\n    next(error);\n  }\n};\n\nconst create = async (req, res, next) =\u003e {\n  try {\n    // Implement your logic create data here\n  } catch (error) {\n    next(error);\n  }\n};\n\nconst update = async (req, res, next) =\u003e {\n  try {\n    // Implement your logic update data here\n  } catch (error) {\n    next(error);\n  }\n};\n\nconst remove = async (req, res, next) =\u003e {\n  try {\n    // Implement your logic remove data here\n  } catch (error) {\n    next(error);\n  }\n};\n\nexport default { get, getById, create, update, remove };\n```\n\n- TypeScript\n\n```typescript\nimport { Request, Response, NextFunction } from 'express';\n\nconst get = async (\n  req: Request,\n  res: Response,\n  next: NextFunction,\n): Promise\u003cvoid\u003e =\u003e {\n  try {\n    // Implement your logic to get data here\n  } catch (error) {\n    next(error);\n  }\n};\n\nconst getById = async (\n  req: Request,\n  res: Response,\n  next: NextFunction,\n): Promise\u003cvoid\u003e =\u003e {\n  try {\n    // Implement your logic to get data by id here\n  } catch (error) {\n    next(error);\n  }\n};\n\nconst create = async (\n  req: Request,\n  res: Response,\n  next: NextFunction,\n): Promise\u003cvoid\u003e =\u003e {\n  try {\n    // Implement your logic to create data here\n  } catch (error) {\n    next(error);\n  }\n};\n\nconst update = async (\n  req: Request,\n  res: Response,\n  next: NextFunction,\n): Promise\u003cvoid\u003e =\u003e {\n  try {\n    // Implement your logic to update data here\n  } catch (error) {\n    next(error);\n  }\n};\n\nconst remove = async (\n  req: Request,\n  res: Response,\n  next: NextFunction,\n): Promise\u003cvoid\u003e =\u003e {\n  try {\n    // Implement your logic to remove data here\n  } catch (error) {\n    next(error);\n  }\n};\n\nexport default { get, getById, create, update, remove };\n```\n\n**Code Router**\n\n- JavaScript\n\n```javascript\nimport { Router } from 'express';\nimport testController from '../controllers/test.controller.js';\n\nconst testRouter = Router();\n\ntestRouter.get('/', testController.get);\ntestRouter.get('/:id', testController.getById);\ntestRouter.post('/', testController.create);\ntestRouter.put('/:id', testController.update);\ntestRouter.delete('/:id', testController.remove);\n\nexport default testRouter;\n```\n\n- TypeScript\n\n```typescript\nimport { Router } from 'express';\nimport testController from '../controllers/test.controller.ts';\n\nconst testRouter: Router = Router();\n\ntestRouter.get('/', testController.get);\ntestRouter.get('/:id', testController.getById);\ntestRouter.post('/', testController.create);\ntestRouter.put('/:id', testController.update);\ntestRouter.delete('/:id', testController.remove);\n\nexport default testRouter;\n```\n\n**Code Model**\n\n- JavaScript \u0026 TypeScript\n\n```javascript\nimport sequelize from '../configs/sequelize.config.js';\n\nconst testModel = sequelize.define('test', {\n  // Define your model attributes here\n});\n\nexport default testModel;\n```\n\n**Code Repository**\n\n- JavaScript\n\n```javascript\nimport testModel from '../models/test.model.js';\n\nconst getAllData = async () =\u003e await testModel.findAll();\n\nconst getDataById = async (id) =\u003e await testModel.findOne({ where: id });\n\nconst createData = async (data) =\u003e await testModel.create(data);\n\nconst updateData = async (id, data) =\u003e {\n  await testModel.update(data, { where: { id } });\n  return await testModel.findOne({ where: id });\n};\n\nconst deleteData = async (id) =\u003e {\n  const data = await testModel.findOne({ where: id });\n  await testModel.destroy({ where: { id } });\n  return data;\n};\n\nexport default { getAllData, getDataById, createData, updateData, deleteData };\n```\n\n- TypeScript\n\n```typescript\nimport { Model, FindOptions } from 'sequelize';\nimport testModel from '../models/test.model.ts';\nimport testInterface from '../interfaces/test.interface.ts';\n\nconst getAllData = async (): Promise\u003cModel\u003ctestInterface\u003e[]\u003e =\u003e {\n  return await testModel.findAll();\n};\n\nconst getDataById = async (\n  id: number,\n): Promise\u003cModel\u003ctestInterface\u003e | null\u003e =\u003e {\n  return await testModel.findOne({ where: id });\n};\n\nconst createData = async (\n  data: Partial\u003ctestInterface\u003e,\n): Promise\u003cModel\u003ctestInterface\u003e\u003e =\u003e {\n  return await testModel.create(data);\n};\n\nconst updateData = async (\n  id: number,\n  data: Partial\u003ctestInterface\u003e,\n): Promise\u003cModel\u003ctestInterface\u003e | null\u003e =\u003e {\n  await testModel.update(data, { where: { id } });\n  return await testModel.findOne({ where: id });\n};\n\nconst deleteData = async (id: number): Promise\u003cModel\u003ctestInterface\u003e | null\u003e =\u003e {\n  const data = await testModel.findOne({ where: id });\n  if (data) {\n    await testModel.destroy({ where: { id } });\n  }\n  return data;\n};\n\nexport default { getAllData, getDataById, createData, updateData, deleteData };\n```\n\n**Code Validation**\n\n- JavaScript\n\n```javascript\nimport { z } from 'zod';\n\nconst testValidation = z.object({\n  // Implement your validation schema here\n});\n\nexport default testValidation;\n```\n\n- TypeScript\n\n```typescript\nimport { z } from 'zod';\n\nconst testValidation = z.object({\n  // Implement your validation schema here\n});\n\ntype testType = z.infer\u003ctypeof testValidation\u003e;\n\nexport { testValidation, testType };\n```\n\n**Code Middleware**\n\n- JavaScript\n\n```javascript\nconst testMiddleware = (req, res, next) =\u003e {\n  try {\n    // Implement your middleware logic here\n    next();\n  } catch (error) {\n    next(error);\n  }\n};\n\nexport default testMiddleware;\n```\n\n- TypeScript\n\n```typescript\nimport { Request, Response, NextFunction } from 'express';\n\nconst testMiddleware = (\n  req: Request,\n  res: Response,\n  next: NextFunction,\n): void =\u003e {\n  try {\n    // Implement your middleware logic here\n    next();\n  } catch (error) {\n    next(error);\n  }\n};\n\nexport default testMiddleware;\n```\n\n**Code Util**\n\n- JavaScript\n\n```javascript\nconst testUtil = () =\u003e {\n  // Implement your util logic here\n};\n\nexport default testUtil;\n```\n\n- TypeScript\n\n```typescript\nconst testUtil = (): void =\u003e {\n  // Implement your util logic here\n};\n\nexport default testUtil;\n```\n\n**Code Enum**\n\n- JavaScript\n\n```javascript\nexport const testEnum = Object.freeze({\n  // Implement your enum here\n});\n```\n\n- TypeScript\n\n```typescript\nexport enum testEnum {}\n// Implement your enum here\n```\n\n**Code Interface (Only using TypeScript)**\n\n```typescript\nexport default interface testInterface {\n  // Implement your interface here\n}\n```\n\n**Code Test With Jest and Supertest**\n\n- JavaScript\n\n```javascript\nimport request from 'supertest';\nimport app from '../src/app.js';\n\nconst validToken = 'Bearer valid.token';\nconst invalidToken = 'Bearer invalid.token';\nlet testId;\n\ndescribe('Testing Your API With Jest and Supertest', () =\u003e {\n  beforeEach(async () =\u003e {\n    const res = await request(app)\n      .post('/api/v1/test')\n      .set('Authorization', validToken)\n      .send({\n        // Send your request body in here\n      });\n\n    testId = res.body.id;\n  });\n\n  afterEach(async () =\u003e {\n    await request(app)\n      .delete(`/api/v1/test/${testId}`)\n      .set('Authorization', validToken);\n  });\n\n  describe('POST /api/v1/test - API for creating data', () =\u003e {\n    it('should return 201 if token is valid and request is valid', async () =\u003e {\n      const res = await request(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).toEqual(201);\n      expect(res.body).toHaveProperty('id');\n    });\n\n    it('should return 400 if request is invalid', async () =\u003e {\n      const res = await request(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill with invalid data\n        });\n\n      expect(res.statusCode).toEqual(400);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request(app).post('/api/v1/test').send({\n        // Fill in with valid data\n      });\n\n      expect(res.statusCode).toEqual(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request(app)\n        .post('/api/v1/test')\n        .set('Authorization', invalidToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).toEqual(403);\n    });\n\n    it('should return 409 if data already exists', async () =\u003e {\n      await request(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      const res = await request(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill with the same data\n        });\n\n      expect(res.statusCode).toEqual(409);\n    });\n  });\n\n  describe('GET /api/v1/test - API for get data', () =\u003e {\n    it('should return 200 if token is valid', async () =\u003e {\n      const res = await request(app)\n        .get('/api/v1/test')\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).toEqual(200);\n      expect(Array.isArray(res.body)).toBeTruthy();\n    });\n\n    it('should return 401 if token not found', async () =\u003e {\n      const res = await request(app).get('/api/v1/test');\n\n      expect(res.statusCode).toEqual(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request(app)\n        .get('/api/v1/test')\n        .set('Authorization', invalidToken);\n\n      expect(res.statusCode).toEqual(403);\n    });\n  });\n\n  describe('GET /api/v1/test/:id - API for get data by id', () =\u003e {\n    it('should return 200 if token is valid and ID is valid', async () =\u003e {\n      const res = await request(app)\n        .get(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).toEqual(200);\n      expect(res.body).toHaveProperty('id', authId);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request(app).get(`/api/v1/test/${testId}`);\n\n      expect(res.statusCode).toEqual(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request(app)\n        .get(`/api/v1/test/${testId}`)\n        .set('Authorization', invalidToken);\n\n      expect(res.statusCode).toEqual(403);\n    });\n\n    it('should return 404 if ID is not found', async () =\u003e {\n      const nonExistentId = 'non_existent_id';\n      const res = await request(app)\n        .get(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).toEqual(404);\n    });\n  });\n\n  describe('PUT /api/v1/test/:id - API for update data by id', () =\u003e {\n    it('should return 200 if token is valid, ID is valid and request is valid', async () =\u003e {\n      const res = await request(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data for update\n        });\n\n      expect(res.statusCode).toEqual(200);\n      expect(res.body).toHaveProperty('id', authId);\n    });\n\n    it('should return 400 if token is valid, ID is valid but request is invalid', async () =\u003e {\n      const res = await request(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill with invalid data\n        });\n\n      expect(res.statusCode).toEqual(400);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request(app).put(`/api/v1/test/${testId}`).send({\n        // Fill in with valid data\n      });\n\n      expect(res.statusCode).toEqual(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', invalidToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).toEqual(403);\n    });\n\n    it('should return 404 if ID is invalid', async () =\u003e {\n      const res = await request(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).toEqual(404);\n    });\n\n    it('should return 409 if data already exists', async () =\u003e {\n      // Pertama, buat data yang sama sekali\n      await request(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      // Kemudian coba update dengan data yang sama\n      const res = await request(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill with the same data\n        });\n\n      expect(res.statusCode).toEqual(409);\n    });\n  });\n\n  describe('DELETE /api/v1/test/:id - API for delete data by id', () =\u003e {\n    it('should return 200 if token is valid and ID is valid', async () =\u003e {\n      const res = await request(app)\n        .delete(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).toEqual(200);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request(app).delete(`/api/v1/test/${testId}`);\n\n      expect(res.statusCode).toEqual(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request(app)\n        .delete(`/api/v1/test/${testId}`)\n        .set('Authorization', invalidToken);\n\n      expect(res.statusCode).toEqual(403);\n    });\n\n    it('should return 404 if ID is invalid', async () =\u003e {\n      const nonExistentId = 'non_existent_id';\n      const res = await request(app)\n        .delete(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).toEqual(404);\n    });\n  });\n});\n```\n\n- TypeScript\n\n```typescript\nimport request from 'supertest';\nimport app from '../src/app.ts';\n\nconst validToken: string = 'Bearer valid.token';\nconst invalidToken: string = 'Bearer invalid.token';\nlet testId: number;\n\ndescribe('Testing Your API With Jest and Supertest', () =\u003e {\n  beforeEach(async () =\u003e {\n    const res = await request(app)\n      .post('/api/v1/test')\n      .set('Authorization', validToken)\n      .send({\n        // Send your request body in here\n      });\n\n    testId = res.body.id;\n  });\n\n  afterEach(async () =\u003e {\n    await request(app)\n      .delete(`/api/v1/test/${testId}`)\n      .set('Authorization', validToken);\n  });\n\n  describe('POST /api/v1/test - API for creating data', () =\u003e {\n    it('should return 201 if token is valid and request is valid', async () =\u003e {\n      const res = await request(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).toEqual(201);\n      expect(res.body).toHaveProperty('id');\n    });\n\n    it('should return 400 if request is invalid', async () =\u003e {\n      const res = await request(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill with invalid data\n        });\n\n      expect(res.statusCode).toEqual(400);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request(app).post('/api/v1/test').send({\n        // Fill in with valid data\n      });\n\n      expect(res.statusCode).toEqual(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request(app)\n        .post('/api/v1/test')\n        .set('Authorization', invalidToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).toEqual(403);\n    });\n\n    it('should return 409 if data already exists', async () =\u003e {\n      await request(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      const res = await request(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill with the same data\n        });\n\n      expect(res.statusCode).toEqual(409);\n    });\n  });\n\n  describe('GET /api/v1/test - API for get data', () =\u003e {\n    it('should return 200 if token is valid', async () =\u003e {\n      const res = await request(app)\n        .get('/api/v1/test')\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).toEqual(200);\n      expect(Array.isArray(res.body)).toBeTruthy();\n    });\n\n    it('should return 401 if token not found', async () =\u003e {\n      const res = await request(app).get('/api/v1/test');\n\n      expect(res.statusCode).toEqual(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request(app)\n        .get('/api/v1/test')\n        .set('Authorization', invalidToken);\n\n      expect(res.statusCode).toEqual(403);\n    });\n  });\n\n  describe('GET /api/v1/test/:id - API for get data by id', () =\u003e {\n    it('should return 200 if token is valid and ID is valid', async () =\u003e {\n      const res = await request(app)\n        .get(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).toEqual(200);\n      expect(res.body).toHaveProperty('id', authId);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request(app).get(`/api/v1/test/${testId}`);\n\n      expect(res.statusCode).toEqual(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request(app)\n        .get(`/api/v1/test/${testId}`)\n        .set('Authorization', invalidToken);\n\n      expect(res.statusCode).toEqual(403);\n    });\n\n    it('should return 404 if ID is not found', async () =\u003e {\n      const nonExistentId = 'non_existent_id';\n      const res = await request(app)\n        .get(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).toEqual(404);\n    });\n  });\n\n  describe('PUT /api/v1/test/:id - API for update data by id', () =\u003e {\n    it('should return 200 if token is valid, ID is valid and request is valid', async () =\u003e {\n      const res = await request(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data for update\n        });\n\n      expect(res.statusCode).toEqual(200);\n      expect(res.body).toHaveProperty('id', authId);\n    });\n\n    it('should return 400 if token is valid, ID is valid but request is invalid', async () =\u003e {\n      const res = await request(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill with invalid data\n        });\n\n      expect(res.statusCode).toEqual(400);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request(app).put(`/api/v1/test/${testId}`).send({\n        // Fill in with valid data\n      });\n\n      expect(res.statusCode).toEqual(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', invalidToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).toEqual(403);\n    });\n\n    it('should return 404 if ID is invalid', async () =\u003e {\n      const res = await request(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).toEqual(404);\n    });\n\n    it('should return 409 if data already exists', async () =\u003e {\n      // Pertama, buat data yang sama sekali\n      await request(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      // Kemudian coba update dengan data yang sama\n      const res = await request(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill with the same data\n        });\n\n      expect(res.statusCode).toEqual(409);\n    });\n  });\n\n  describe('DELETE /api/v1/test/:id - API for delete data by id', () =\u003e {\n    it('should return 200 if token is valid and ID is valid', async () =\u003e {\n      const res = await request(app)\n        .delete(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).toEqual(200);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request(app).delete(`/api/v1/test/${testId}`);\n\n      expect(res.statusCode).toEqual(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request(app)\n        .delete(`/api/v1/test/${testId}`)\n        .set('Authorization', invalidToken);\n\n      expect(res.statusCode).toEqual(403);\n    });\n\n    it('should return 404 if ID is invalid', async () =\u003e {\n      const nonExistentId = 'non_existent_id';\n      const res = await request(app)\n        .delete(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).toEqual(404);\n    });\n  });\n});\n```\n\n**Code Test With Mocha and Chai**\n\n- JavaScript\n\n```javascript\nimport app from '../src/app.js';\nimport { use, expect } from 'chai';\nimport { default as chaiHttp, request } from 'chai-http';\n\nuse(chaiHttp);\n\nconst validToken = 'Bearer valid.token';\nconst invalidToken = 'Bearer invalid.token';\nlet testId;\n\ndescribe('Testing Your API With Mocha and Chai', () =\u003e {\n  beforeEach(async () =\u003e {\n    const res = await request\n      .execute(app)\n      .post('/api/v1/test')\n      .set('Authorization', validToken)\n      .send({\n        // Send your request body in here\n      });\n\n    testId = res.body.id;\n  });\n\n  afterEach(async () =\u003e {\n    await request\n      .execute(app)\n      .delete(`/api/v1/test/${testId}`)\n      .set('Authorization', validToken);\n  });\n\n  describe('POST /api/v1/test - API for creating data', () =\u003e {\n    it('should return 201 if token is valid and request is valid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).equal(201);\n      expect(res.body).haveOwnProperty('id');\n    });\n\n    it('should return 400 if request is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill with invalid data\n        });\n\n      expect(res.statusCode).equal(400);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request.execute(app).post('/api/v1/test').send({\n        // Fill in with valid data\n      });\n\n      expect(res.statusCode).equal(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .post('/api/v1/test')\n        .set('Authorization', invalidToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).equal(403);\n    });\n\n    it('should return 409 if data already exists', async () =\u003e {\n      await request\n        .execute(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      const res = await request\n        .execute(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill with the same data\n        });\n\n      expect(res.statusCode).equal(409);\n    });\n  });\n\n  describe('GET /api/v1/test - API for get data', () =\u003e {\n    it('should return 200 if token is valid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .get('/api/v1/test')\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).equal(200);\n      expect(Array.isArray(res.body)).to.be.true;\n    });\n\n    it('should return 401 if token not found', async () =\u003e {\n      const res = await request.execute(app).get('/api/v1/test');\n\n      expect(res.statusCode).equal(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .get('/api/v1/test')\n        .set('Authorization', invalidToken);\n\n      expect(res.statusCode).equal(403);\n    });\n  });\n\n  describe('GET /api/v1/test/:id - API for get data by id', () =\u003e {\n    it('should return 200 if token is valid and ID is valid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .get(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).equal(200);\n      expect(res.body).haveOwnProperty('id', testId);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request.execute(app).get(`/api/v1/test/${testId}`);\n\n      expect(res.statusCode).equal(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .get(`/api/v1/test/${testId}`)\n        .set('Authorization', invalidToken);\n\n      expect(res.statusCode).equal(403);\n    });\n\n    it('should return 404 if ID is not found', async () =\u003e {\n      const nonExistentId = 'non_existent_id';\n      const res = await request\n        .execute(app)\n        .get(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).equal(404);\n    });\n  });\n\n  describe('PUT /api/v1/test/:id - API for update data by id', () =\u003e {\n    it('should return 200 if token is valid, ID is valid and request is valid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data for update\n        });\n\n      expect(res.statusCode).equal(200);\n      expect(res.body).haveOwnProperty('id', testId);\n    });\n\n    it('should return 400 if token is valid, ID is valid but request is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill with invalid data\n        });\n\n      expect(res.statusCode).equal(400);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .put(`/api/v1/test/${testId}`)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).equal(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', invalidToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).equal(403);\n    });\n\n    it('should return 404 if ID is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).equal(404);\n    });\n\n    it('should return 409 if data already exists', async () =\u003e {\n      // Pertama, buat data yang sama sekali\n      await request\n        .execute(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      // Kemudian coba update dengan data yang sama\n      const res = await request\n        .execute(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill with the same data\n        });\n\n      expect(res.statusCode).equal(409);\n    });\n  });\n\n  describe('DELETE /api/v1/test/:id - API for delete data by id', () =\u003e {\n    it('should return 200 if token is valid and ID is valid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .delete(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).equal(200);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request.execute(app).delete(`/api/v1/test/${testId}`);\n\n      expect(res.statusCode).equal(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .delete(`/api/v1/test/${testId}`)\n        .set('Authorization', invalidToken);\n\n      expect(res.statusCode).equal(403);\n    });\n\n    it('should return 404 if ID is invalid', async () =\u003e {\n      const nonExistentId = 'non_existent_id';\n      const res = await request\n        .execute(app)\n        .delete(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).equal(404);\n    });\n  });\n});\n```\n\n- TypeScript\n\n```typescript\nimport app from '../src/app.ts';\nimport { use, expect } from 'chai';\nimport { default as chaiHttp, request } from 'chai-http';\n\nuse(chaiHttp);\n\nconst validToken: string = 'Bearer valid.token';\nconst invalidToken: string = 'Bearer invalid.token';\nlet testId: number;\n\ndescribe('Testing Your API With Mocha and Chai', () =\u003e {\n  beforeEach(async () =\u003e {\n    const res = await request\n      .execute(app)\n      .post('/api/v1/test')\n      .set('Authorization', validToken)\n      .send({\n        // Send your request body in here\n      });\n\n    testId = res.body.id;\n  });\n\n  afterEach(async () =\u003e {\n    await request\n      .execute(app)\n      .delete(`/api/v1/test/${testId}`)\n      .set('Authorization', validToken);\n  });\n\n  describe('POST /api/v1/test - API for creating data', () =\u003e {\n    it('should return 201 if token is valid and request is valid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).equal(201);\n      expect(res.body).haveOwnProperty('id');\n    });\n\n    it('should return 400 if request is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill with invalid data\n        });\n\n      expect(res.statusCode).equal(400);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request.execute(app).post('/api/v1/test').send({\n        // Fill in with valid data\n      });\n\n      expect(res.statusCode).equal(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .post('/api/v1/test')\n        .set('Authorization', invalidToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).equal(403);\n    });\n\n    it('should return 409 if data already exists', async () =\u003e {\n      await request\n        .execute(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      const res = await request\n        .execute(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill with the same data\n        });\n\n      expect(res.statusCode).equal(409);\n    });\n  });\n\n  describe('GET /api/v1/test - API for get data', () =\u003e {\n    it('should return 200 if token is valid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .get('/api/v1/test')\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).equal(200);\n      expect(Array.isArray(res.body)).to.be.true;\n    });\n\n    it('should return 401 if token not found', async () =\u003e {\n      const res = await request.execute(app).get('/api/v1/test');\n\n      expect(res.statusCode).equal(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .get('/api/v1/test')\n        .set('Authorization', invalidToken);\n\n      expect(res.statusCode).equal(403);\n    });\n  });\n\n  describe('GET /api/v1/test/:id - API for get data by id', () =\u003e {\n    it('should return 200 if token is valid and ID is valid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .get(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).equal(200);\n      expect(res.body).haveOwnProperty('id', testId);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request.execute(app).get(`/api/v1/test/${testId}`);\n\n      expect(res.statusCode).equal(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .get(`/api/v1/test/${testId}`)\n        .set('Authorization', invalidToken);\n\n      expect(res.statusCode).equal(403);\n    });\n\n    it('should return 404 if ID is not found', async () =\u003e {\n      const nonExistentId = 'non_existent_id';\n      const res = await request\n        .execute(app)\n        .get(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).equal(404);\n    });\n  });\n\n  describe('PUT /api/v1/test/:id - API for update data by id', () =\u003e {\n    it('should return 200 if token is valid, ID is valid and request is valid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data for update\n        });\n\n      expect(res.statusCode).equal(200);\n      expect(res.body).haveOwnProperty('id', testId);\n    });\n\n    it('should return 400 if token is valid, ID is valid but request is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill with invalid data\n        });\n\n      expect(res.statusCode).equal(400);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .put(`/api/v1/test/${testId}`)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).equal(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', invalidToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).equal(403);\n    });\n\n    it('should return 404 if ID is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      expect(res.statusCode).equal(404);\n    });\n\n    it('should return 409 if data already exists', async () =\u003e {\n      // Pertama, buat data yang sama sekali\n      await request\n        .execute(app)\n        .post('/api/v1/test')\n        .set('Authorization', validToken)\n        .send({\n          // Fill in with valid data\n        });\n\n      // Kemudian coba update dengan data yang sama\n      const res = await request\n        .execute(app)\n        .put(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken)\n        .send({\n          // Fill with the same data\n        });\n\n      expect(res.statusCode).equal(409);\n    });\n  });\n\n  describe('DELETE /api/v1/test/:id - API for delete data by id', () =\u003e {\n    it('should return 200 if token is valid and ID is valid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .delete(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).equal(200);\n    });\n\n    it('should return 401 if token is not found', async () =\u003e {\n      const res = await request.execute(app).delete(`/api/v1/test/${testId}`);\n\n      expect(res.statusCode).equal(401);\n    });\n\n    it('should return 403 if token is invalid', async () =\u003e {\n      const res = await request\n        .execute(app)\n        .delete(`/api/v1/test/${testId}`)\n        .set('Authorization', invalidToken);\n\n      expect(res.statusCode).equal(403);\n    });\n\n    it('should return 404 if ID is invalid', async () =\u003e {\n      const nonExistentId = 'non_existent_id';\n      const res = await request\n        .execute(app)\n        .delete(`/api/v1/test/${testId}`)\n        .set('Authorization', validToken);\n\n      expect(res.statusCode).equal(404);\n    });\n  });\n});\n```\n\n\u003cbr /\u003e\n\n## 🔗 Links\n\n- [ExpressJS](https://expressjs.com/)\n- [Git](https://git-scm.com/)\n- [Node.js](https://nodejs.org/en)\n- [npm](https://www.npmjs.com/) (Node Package Manager)\n- [Sequelize](https://sequelize.org/)\n- [TypeScript](https://www.typescriptlang.org/)\n- [Prettier](https://prettier.io/)\n- [ESLint](https://eslint.org/)\n- [Husky](https://typicode.github.io/husky/)\n- [Commitlint](https://commitlint.js.org/)\n\n\u003cbr /\u003e\n\n## 💰 Donate\n\nSupport My Work 💙\n\nHi there! If you find this tool useful and it helps you in your work, consider supporting me with a small donation. Your support is completely optional, but it would mean a lot and help me continue improving this tool.\n\nThank you for using this Express CLI! 😊\nHappy coding! 🚀\n\n[Link Donate](https://saweria.co/thomasalberto)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxriot45%2Fexpress-js-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxriot45%2Fexpress-js-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxriot45%2Fexpress-js-cli/lists"}