Fixing tests
All checks were successful
Anatid Blog CI Workflow / test (./backend) (push) Successful in 28s
Anatid Blog CI Workflow / test (./frontend) (push) Successful in 29s
Anatid Blog CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/anatid-blog-backend, ./backend) (push) Successful in 51s
Anatid Blog CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/anatid-blog-frontend, ./frontend) (push) Successful in 43s
Anatid Blog CI Workflow / deploy (push) Successful in 23s
All checks were successful
Anatid Blog CI Workflow / test (./backend) (push) Successful in 28s
Anatid Blog CI Workflow / test (./frontend) (push) Successful in 29s
Anatid Blog CI Workflow / build-and-push-images (./backend/Dockerfile, git.anatid.net/tabris/anatid-blog-backend, ./backend) (push) Successful in 51s
Anatid Blog CI Workflow / build-and-push-images (./frontend/Dockerfile, git.anatid.net/tabris/anatid-blog-frontend, ./frontend) (push) Successful in 43s
Anatid Blog CI Workflow / deploy (push) Successful in 23s
This commit is contained in:
parent
6509965ddb
commit
6b414d9b71
@ -1,10 +1,9 @@
|
||||
import { Module } from '@nestjs/common';
|
||||
import { AppController } from './app.controller';
|
||||
import { AppService } from './app.service';
|
||||
import { PostsModule } from './posts/posts.module';
|
||||
import { PostModule } from './post/post.module';
|
||||
import { DatabaseModule } from './database/database.module';
|
||||
import { ConfigModule } from '@nestjs/config';
|
||||
import { PostModule } from './post/post.module';
|
||||
import configuration from './config/configuration';
|
||||
|
||||
@Module({
|
||||
@ -13,7 +12,6 @@ import configuration from './config/configuration';
|
||||
load: [configuration]
|
||||
}),
|
||||
DatabaseModule,
|
||||
PostsModule,
|
||||
PostModule
|
||||
],
|
||||
controllers: [AppController],
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Entity, Column, PrimaryGeneratedColumn, ManyToOne } from 'typeorm';
|
||||
import { Post } from './post.entity';
|
||||
import { Post } from '../post/post.entity';
|
||||
|
||||
@Entity()
|
||||
export class Comment {
|
||||
|
@ -1,5 +1,12 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { PostController } from './post.controller';
|
||||
import { PostService } from './post.service';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { Post } from './post.entity';
|
||||
import { Comment } from '../comment/comment.entity';
|
||||
|
||||
const mockPost = new Post();
|
||||
const mockComment = new Comment();
|
||||
|
||||
describe('PostController', () => {
|
||||
let controller: PostController;
|
||||
@ -7,6 +14,23 @@ describe('PostController', () => {
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
controllers: [PostController],
|
||||
providers: [
|
||||
PostService,
|
||||
{
|
||||
provide: getRepositoryToken(Post),
|
||||
useValue: {
|
||||
save: jest.fn().mockResolvedValue(mockPost),
|
||||
find: jest.fn().mockResolvedValue([mockPost]),
|
||||
},
|
||||
},
|
||||
{
|
||||
provide: getRepositoryToken(Comment),
|
||||
useValue: {
|
||||
save: jest.fn().mockResolvedValue(mockComment),
|
||||
find: jest.fn().mockResolvedValue([mockComment]),
|
||||
},
|
||||
},
|
||||
],
|
||||
}).compile();
|
||||
|
||||
controller = module.get<PostController>(PostController);
|
||||
|
@ -1,4 +1,4 @@
|
||||
import { Post } from './post';
|
||||
import { Post } from './post.entity';
|
||||
|
||||
describe('Post', () => {
|
||||
it('should be defined', () => {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from ‘typeorm’;
|
||||
import { Comment } from ‘./comment.entity’;
|
||||
import { Entity, Column, PrimaryGeneratedColumn, OneToMany } from 'typeorm';
|
||||
import { Comment } from '../comment/comment.entity';
|
||||
|
||||
@Entity()
|
||||
export class Post {
|
||||
|
@ -1,12 +1,36 @@
|
||||
import { Test, TestingModule } from '@nestjs/testing';
|
||||
import { PostService } from './post.service';
|
||||
import { PostController } from './post.controller';
|
||||
import { getRepositoryToken } from '@nestjs/typeorm';
|
||||
import { Post } from './post.entity';
|
||||
import { Comment } from '../comment/comment.entity';
|
||||
|
||||
const mockPost = new Post();
|
||||
const mockComment = new Comment();
|
||||
|
||||
describe('PostService', () => {
|
||||
let service: PostService;
|
||||
|
||||
beforeEach(async () => {
|
||||
const module: TestingModule = await Test.createTestingModule({
|
||||
providers: [PostService],
|
||||
controllers: [PostController],
|
||||
providers: [
|
||||
PostService,
|
||||
{
|
||||
provide: getRepositoryToken(Post),
|
||||
useValue: {
|
||||
save: jest.fn().mockResolvedValue(mockPost),
|
||||
find: jest.fn().mockResolvedValue([mockPost]),
|
||||
},
|
||||
},
|
||||
{
|
||||
provide: getRepositoryToken(Comment),
|
||||
useValue: {
|
||||
save: jest.fn().mockResolvedValue(mockComment),
|
||||
find: jest.fn().mockResolvedValue([mockComment]),
|
||||
},
|
||||
},
|
||||
],
|
||||
}).compile();
|
||||
|
||||
service = module.get<PostService>(PostService);
|
||||
|
Loading…
x
Reference in New Issue
Block a user