Skip to content

Commit

Permalink
Merge pull request #106 from lassijjk/CI_final
Browse files Browse the repository at this point in the history
CI
  • Loading branch information
AnisulMahmud authored Dec 12, 2023
2 parents 4d24891 + 78857e9 commit ddccb8d
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 5 deletions.
13 changes: 10 additions & 3 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,20 @@ jobs:
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: 14
node-version: 14

- name: Clear npm cache
run: npm cache clean -f

- name: Install dependencies
run: npm install

- name: Build
run: npm run build
- name: Install Amplify CLI
run: npm install -g @aws-amplify/cli

- name: Run tests
run: npm test

- name: Generate Code Coverage
run: npm run coverage

10 changes: 8 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@
"lint": "eslint \"src/**/*.{js,jsx,ts,tsx}\"",
"lint:fix": "eslint --fix \"src/**/*.{js,jsx,ts,tsx}\"",
"format": "prettier --write \"src/**/*.{js,jsx,ts,tsx,css,md}\" --config ./.prettierrc.json",
"preview": "vite preview"
"preview": "vite preview",
"test": "vitest",
"coverage": "vitest run --coverage",
"test-with-coverage": "npm run test && npm run coverage"
},
"dependencies": {
"@aws-amplify/ui-react": "^5.3.1",
Expand Down Expand Up @@ -47,6 +50,8 @@
"@typescript-eslint/eslint-plugin": "^6.6.0",
"@typescript-eslint/parser": "^6.6.0",
"@vitejs/plugin-react": "^4.0.3",
"@vitest/coverage-v8": "^0.34.6",
"c8": "^8.0.1",
"eslint": "^8.48.0",
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-prettier": "^5.0.0",
Expand All @@ -55,6 +60,7 @@
"eslint-plugin-react-refresh": "^0.4.3",
"prettier": "^3.0.3",
"typescript": "^5.0.2",
"vite": "^4.4.5"
"vite": "^4.4.5",
"vitest": "^0.34.6"
}
}
12 changes: 12 additions & 0 deletions src/test/convertDateFilter.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { describe, it, expect } from 'vitest';

import { convertDateforFilter } from '../utils/convertDateForFilter';

describe('convertDateforFilter', () => {
it('should format the date correctly', () => {
const date = new Date('2022-01-01T15:30:00Z');
const result = convertDateforFilter(date);

expect(result).toEqual(new Date('2022-01-01T00:00:00Z'));
});
});
16 changes: 16 additions & 0 deletions src/test/convertToReadableTime.test.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { describe, it, expect } from 'vitest';


import { convertToReadableTime } from '../utils/convertToReadableTime';



describe('convertToReadableTime', () => {
it('should format the time correctly', () => {
const date = new Date('2022-01-01T00:00:00Z');
const result = convertToReadableTime(date);


expect(result).toBe('02:00');
});
});

0 comments on commit ddccb8d

Please sign in to comment.