Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: CI — Lint & Test

on:
push:
branches-ignore: [develop]
pull_request:
branches: ['**']

jobs:
ci:
name: Lint & Test
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

- name: Run tests
run: npm run test
4 changes: 1 addition & 3 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CI/CD Deploy to EC2
name: CI/CD Deploy to EC2

on:
push:
Expand Down Expand Up @@ -56,8 +56,6 @@ jobs:
echo "POSTGRES_DB=${{ secrets.POSTGRES_DB }}" >> .env.production
echo "POSTGRES_USER=${{ secrets.POSTGRES_USER }}" >> .env.production
echo "POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" >> .env.production
echo "REDIS_HOST=localhost" >> .env.production
echo "REDIS_PORT=6379" >> .env.production
echo "REDIS_URL=${{ secrets.REDIS_URL }}" >> .env.production
echo "JWT_SECRET=${{ secrets.JWT_SECRET }}" >> .env.production
echo "JWT_EXPIRES_IN=${{ secrets.JWT_EXPIRES_IN }}" >> .env.production
Expand Down
3 changes: 1 addition & 2 deletions src/app.controller.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ describe('AppController', () => {
describe('health check', () => {
it('should return health check object', () => {
expect(appController.getHealthCheck()).toEqual({
status_code: 200,
detail: 'ok',
status: 'ok',
result: 'working',
});
});
Expand Down
31 changes: 30 additions & 1 deletion src/modules/companies/__tests__/companies.controller.spec.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,43 @@
import { Test, TestingModule } from '@nestjs/testing';
import { CompaniesController } from '../controllers/companies.controller';
import { CompaniesService } from '../services/companies.service';
import { CompanyMembersService } from '../services/company-members.service';
import { CompanyRepository } from '../repositories/company.repository';
import { DataSource } from 'typeorm';

describe('CompaniesController', () => {
let controller: CompaniesController;

beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [CompaniesController],
providers: [CompaniesService],
providers: [
CompaniesService,
{
provide: CompanyRepository,
useValue: {
find: jest.fn(),
findOne: jest.fn(),
save: jest.fn(),
remove: jest.fn(),
findBySlugOrFail: jest.fn(),
findBySlugRaw: jest.fn(),
findPaginated: jest.fn(),
},
},
{
provide: CompanyMembersService,
useValue: {
createInitialOwner: jest.fn(),
},
},
{
provide: DataSource,
useValue: {
transaction: jest.fn(),
},
},
],
}).compile();

controller = module.get<CompaniesController>(CompaniesController);
Expand Down