diff --git a/.github/workflows/initalSetup.yml b/.github/workflows/initalSetup.yml deleted file mode 100644 index 3700921..0000000 --- a/.github/workflows/initalSetup.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: Node.js CI - -on: - push: - branches: - - master - pull_request: - branches: - - master - -jobs: - build: - runs-on: ubuntu-latest - - strategy: - matrix: - node-version: [20.x] - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - - - name: Setup Node.js - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - - name: Install dependencies - run: npm install - - - name: Run tests - run: | - npm test -- --ci --reporters="default" --reporters="jest-silent-reporter" - continue-on-error: true - - - name: Display test case summary - run: | - echo "Test Summary:" - npm test -- --ci --reporters="jest-summary-reporter" diff --git a/jest.config.js b/jest.config.js index e5f9bec..07b39c9 100644 --- a/jest.config.js +++ b/jest.config.js @@ -12,6 +12,7 @@ module.exports = { verbose: true, reporters: [ "default", + "jest-summary-reporter", [ "jest-html-reporter", { diff --git a/package.json b/package.json index d827b06..7d07cd3 100644 --- a/package.json +++ b/package.json @@ -70,6 +70,7 @@ "jest": "^29.7.0", "jest-html-reporter": "^3.10.2", "jest-junit": "^16.0.0", + "jest-summary-reporter": "^0.0.2", "nodemon": "^3.1.4", "supertest": "^7.0.0" } diff --git a/test-report.html b/test-report.html index 209b901..7a3726a 100644 --- a/test-report.html +++ b/test-report.html @@ -257,4 +257,4 @@ font-size: 1rem; padding: 0 0.5rem; } -

Test Report

Started: 2024-10-16 11:14:06
Suites (10)
10 passed
0 failed
0 pending
Tests (46)
46 passed
0 failed
0 pending
CategoryController > createCategory
should create a category successfully
passed
0.028s
CategoryController > createCategory
should return a BadRequestError if name is missing
passed
0.011s
CategoryController > getCategories
should return a list of categories with pagination
passed
0.008s
CategoryController > getCategoryById
should return a category by ID
passed
0.01s
CategoryController > getCategoryById
should return a NotFoundError if category is not found
passed
0.008s
CategoryController > updateCategory
should update a category successfully
passed
0.007s
CategoryController > updateCategory
should return a BadRequestError if name is missing
passed
0.009s
CategoryController > deleteCategory
should delete a category successfully
passed
0.006s
CategoryController > deleteCategory
should return a NotFoundError if category is not found
passed
0.007s
UserController > register
should register a user successfully
passed
0.015s
UserController > register
should handle missing fields error
passed
0.011s
UserController > login
should login successfully and set access_token cookie
passed
0.022s
ProductsRepo > createProduct
should create a product and return it
passed
0.011s
ProductsRepo > getProducts
should return products with pagination
passed
0.005s
ProductsRepo > getProductById
should return a product by ID
passed
0.006s
ProductsRepo > getProductById
should throw a NotFoundError if product ID does not exist
passed
0.026s
ProductsRepo > updateProduct
should update a product
passed
0.004s
ProductsRepo > deleteProduct
should delete a product successfully
passed
0.01s
ProductsRepo > deleteProduct
should throw a NotFoundError if product ID does not exist
passed
0.007s
CategoryService
getCategoryById failure
passed
0.152s
ProductService > createProduct
should create a product and return it
passed
0.011s
ProductService > updateProduct
should update a product
passed
0.005s
ProductService > deleteProduct
should delete a product successfully
passed
0.006s
ProductService > deleteProduct
should throw a NotFoundError if product ID does not exist
passed
0.029s
CategoryService > createCategory
should create a category and return it
passed
0.01s
CategoryService > createCategory
should throw a ConflictError if category already exists
passed
0.024s
CategoryService > getCategories
should return categories with pagination
passed
0.007s
CategoryService > getCategoryById
should return a category by ID
passed
0.007s
CategoryService > getCategoryById
should throw a NotFoundError if category is not found
passed
0.007s
CategoryService > updateCategory
should update a category
passed
0.008s
CategoryService > updateCategory
should throw a NotFoundError if category ID does not exist
passed
0.007s
CategoryService > deleteCategory
should delete a category successfully
passed
0.008s
CategoryService > deleteCategory
should throw a NotFoundError if category ID does not exist
passed
0.008s
UserController > register
should handle missing fields error
passed
0.014s
UserController > login
should login successfully and set access_token cookie
passed
0.012s
UserController > login
should handle missing email or password
passed
0.006s
UserController > login
should handle service error
passed
0.012s
UserRepo > checkUser
should find a user by email
passed
0.009s
UserRepo > checkUser
should return null if no user found
passed
0.004s
UserRepo > register
should create a new user
passed
0.011s
CategoryRepo > createCategory
should create a category and return it
passed
0.007s
CategoryRepo > getCategoryById
should return a category by ID
passed
0.004s
CategoryRepo > updateCategory
should update a category
passed
0.005s
ProductController > createProduct
should handle service error
passed
0.012s
ProductController > updateProduct
should handle not found error
passed
0.002s
ProductController > deleteProduct
should handle not found error
passed
0.001s
\ No newline at end of file +

Test Report

Started: 2024-10-16 12:18:33
Suites (10)
10 passed
0 failed
0 pending
Tests (46)
46 passed
0 failed
0 pending
CategoryController > createCategory
should create a category successfully
passed
0.031s
CategoryController > createCategory
should return a BadRequestError if name is missing
passed
0.008s
CategoryController > getCategories
should return a list of categories with pagination
passed
0.009s
CategoryController > getCategoryById
should return a category by ID
passed
0.008s
CategoryController > getCategoryById
should return a NotFoundError if category is not found
passed
0.009s
CategoryController > updateCategory
should update a category successfully
passed
0.009s
CategoryController > updateCategory
should return a BadRequestError if name is missing
passed
0.009s
CategoryController > deleteCategory
should delete a category successfully
passed
0.007s
CategoryController > deleteCategory
should return a NotFoundError if category is not found
passed
0.006s
ProductsRepo > createProduct
should create a product and return it
passed
0.016s
ProductsRepo > getProducts
should return products with pagination
passed
0.005s
ProductsRepo > getProductById
should return a product by ID
passed
0.007s
ProductsRepo > getProductById
should throw a NotFoundError if product ID does not exist
passed
0.036s
ProductsRepo > updateProduct
should update a product
passed
0.006s
ProductsRepo > deleteProduct
should delete a product successfully
passed
0.009s
ProductsRepo > deleteProduct
should throw a NotFoundError if product ID does not exist
passed
0.008s
UserController > register
should register a user successfully
passed
0.021s
UserController > register
should handle missing fields error
passed
0.008s
UserController > login
should login successfully and set access_token cookie
passed
0.013s
CategoryService
getCategoryById failure
passed
0.154s
ProductService > createProduct
should create a product and return it
passed
0.01s
ProductService > updateProduct
should update a product
passed
0.004s
ProductService > deleteProduct
should delete a product successfully
passed
0.004s
ProductService > deleteProduct
should throw a NotFoundError if product ID does not exist
passed
0.021s
CategoryService > createCategory
should create a category and return it
passed
0.01s
CategoryService > createCategory
should throw a ConflictError if category already exists
passed
0.023s
CategoryService > getCategories
should return categories with pagination
passed
0.008s
CategoryService > getCategoryById
should return a category by ID
passed
0.007s
CategoryService > getCategoryById
should throw a NotFoundError if category is not found
passed
0.008s
CategoryService > updateCategory
should update a category
passed
0.007s
CategoryService > updateCategory
should throw a NotFoundError if category ID does not exist
passed
0.006s
CategoryService > deleteCategory
should delete a category successfully
passed
0.006s
CategoryService > deleteCategory
should throw a NotFoundError if category ID does not exist
passed
0.007s
UserController > register
should handle missing fields error
passed
0.011s
UserController > login
should login successfully and set access_token cookie
passed
0.019s
UserController > login
should handle missing email or password
passed
0.008s
UserController > login
should handle service error
passed
0.012s
UserRepo > checkUser
should find a user by email
passed
0.012s
UserRepo > checkUser
should return null if no user found
passed
0.004s
UserRepo > register
should create a new user
passed
0.003s
CategoryRepo > createCategory
should create a category and return it
passed
0.008s
CategoryRepo > getCategoryById
should return a category by ID
passed
0.004s
CategoryRepo > updateCategory
should update a category
passed
0.004s
ProductController > createProduct
should handle service error
passed
0.014s
ProductController > updateProduct
should handle not found error
passed
0.002s
ProductController > deleteProduct
should handle not found error
passed
0.002s
\ No newline at end of file