@@ -2,9 +2,9 @@ import { Card } from '#card/domain/card';
2
2
import { CardInMemoryRepository } from '#card/infra/repository/in-memory/card.in-memory.repository' ;
3
3
import { CardMongoRepository } from '#card/infra/repository/mongo/card.mongo.repository' ;
4
4
import { CardMySQLRepository } from '#card/infra/repository/mysql/card.mysql.repository' ;
5
+ import { setupMySQL } from '#core/@seedwork/infra/testing/helpers/db' ;
5
6
import { NotFoundException } from '#shared/exception/not-found.exception' ;
6
7
import { MongoHelper } from '#shared/infra/db/mongo/mongo-helper' ;
7
- import { MySQLConnection } from '#shared/infra/db/mysql/mysql-connection' ;
8
8
import { RepositoryVendor } from '#shared/utils/repository-vendor' ;
9
9
10
10
import { UpdateCardUseCase } from './update-card.use-case' ;
@@ -65,23 +65,7 @@ describe('UpdateCardUseCase', () => {
65
65
} ) ;
66
66
67
67
describe ( 'MYSQL' , ( ) => {
68
- const connection = MySQLConnection . getInstance ( ) ;
69
- const truncateTables = async ( ) => {
70
- const database = process . env . DB_DATABASE_TEST ;
71
-
72
- await connection . query ( 'SET FOREIGN_KEY_CHECKS = 0' ) ;
73
- await connection . query ( `TRUNCATE TABLE \`${ database } \`.\`cards\`` ) ;
74
- await connection . query ( `TRUNCATE TABLE \`${ database } \`.\`transactions\`` ) ;
75
- await connection . query ( 'SET FOREIGN_KEY_CHECKS = 1' ) ;
76
- } ;
77
-
78
- beforeEach ( async ( ) => {
79
- await truncateTables ( ) ;
80
- } ) ;
81
-
82
- afterEach ( async ( ) => {
83
- await truncateTables ( ) ;
84
- } ) ;
68
+ setupMySQL ( 'cards' ) ;
85
69
86
70
it ( 'should update a card' , async ( ) => {
87
71
const { updateUseCase, repository } = makeSut ( 'MYSQL' ) ;
0 commit comments