-
Notifications
You must be signed in to change notification settings - Fork 0
[LOCKLITE-37] Integrate CI with linter, tests with coverage, and build #31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 11 commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
fb81959
ci: Create CI
vbetsch 8f1e3d4
ci: Refactor naming
vbetsch 0cbd8ce
chore(tests): Define coverage
vbetsch 9ac33ac
chore: Add coverage command
vbetsch 57cca1e
ci: Run only PR
vbetsch a167445
chore(ide): Exclude coverage dir
vbetsch 57b0241
chore(tests): Ignore lib and prisma folders in coverage
vbetsch 8bbbdc8
refactor(make): Refactor tests command
vbetsch fd74c3e
chore(tests): Fix jest config
vbetsch 81afb80
perf(tests): Refactor jest config
vbetsch 73c22e2
test: Add tests for UserAdapter
vbetsch d4a278f
chore: Create format check
vbetsch dac90a2
chore(linter): Import plugin:prettier/recommended
vbetsch e5454e0
chore(deps): Install eslint-config-prettier
vbetsch 315c321
chore(make): Remove npm run format:c
vbetsch 8c855bb
chore(linter): Remove formatter from linter
vbetsch d1f89c9
chore(make): Add format commands
vbetsch 162aca7
ci: Add formatter:prettier job
vbetsch e7220f3
revert: Test to import prettier in linter again
vbetsch d5a482b
fix(linter): Fix configuration
vbetsch 399d00a
fix: Clean
vbetsch 11e94d2
fix(make): Fix format command
vbetsch a70a739
style: Format files with Prettier
vbetsch e85140c
fix: Fix linter issues
vbetsch File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| pull_request: | ||
| branches: | ||
| - main | ||
| - develop | ||
|
|
||
| jobs: | ||
| linter_eslint: | ||
| name: linter:eslint | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| - run: npm run lint | ||
|
|
||
| tests_units: | ||
| name: tests:units | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| - run: npm run test:cov | ||
|
|
||
| build_app: | ||
| name: build:app | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: 'npm' | ||
| - run: npm ci | ||
| - run: npm run build |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,55 @@ | ||
| import "reflect-metadata"; | ||
|
|
||
| import {UserAdapter} from '@api/adapters/user.adapter'; | ||
| import type {MasterAccount} from '@prisma/generated'; | ||
| import type {UserModelDto} from '@shared/dto/models/user.model.dto'; | ||
|
|
||
| describe('UserAdapter', () => { | ||
| let adapter: UserAdapter; | ||
|
|
||
| beforeEach(() => { | ||
| adapter = new UserAdapter(); | ||
| }); | ||
|
|
||
| describe('getUsersFromMasterAccounts()', () => { | ||
| it('should map an array of MasterAccount to UserModelDto[]', () => { | ||
| const masterAccounts: MasterAccount[] = [ | ||
| { | ||
| id: '1', | ||
| email: 'alice@example.com', | ||
| password: 'secret1', | ||
| createdAt: new Date('2025-01-01T00:00:00.000Z'), | ||
| } as any, | ||
| { | ||
| id: '2', | ||
| email: 'bob@example.com', | ||
| password: 'secret2', | ||
| createdAt: new Date('2025-02-02T00:00:00.000Z'), | ||
| } as any, | ||
vbetsch marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| ]; | ||
|
|
||
| const expected: UserModelDto[] = [ | ||
| { | ||
| id: '1', | ||
| email: 'alice@example.com', | ||
| password: 'secret1', | ||
| createdAt: new Date('2025-01-01T00:00:00.000Z'), | ||
| }, | ||
| { | ||
| id: '2', | ||
| email: 'bob@example.com', | ||
| password: 'secret2', | ||
| createdAt: new Date('2025-02-02T00:00:00.000Z'), | ||
| }, | ||
| ]; | ||
|
|
||
| const result = adapter.getUsersFromMasterAccounts(masterAccounts); | ||
| expect(result).toEqual(expected); | ||
vbetsch marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }); | ||
|
|
||
| it('should return an empty array when passed an empty array', () => { | ||
| const result = adapter.getUsersFromMasterAccounts([]); | ||
| expect(result).toEqual([]); | ||
| }); | ||
| }); | ||
| }); | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.