Skip to content

Commit

Permalink
test: 將測試資料庫改成 sqlite
Browse files Browse the repository at this point in the history
  • Loading branch information
a20688392 committed Jun 4, 2023
1 parent edfdf64 commit 96b1801
Show file tree
Hide file tree
Showing 3 changed files with 319 additions and 25 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"lint-staged": "^13.1.0",
"prettier": "^2.3.2",
"source-map-support": "^0.5.20",
"sqlite3": "^5.1.6",
"supertest": "^6.1.3",
"ts-jest": "28.0.8",
"ts-loader": "^9.2.3",
Expand Down
16 changes: 3 additions & 13 deletions src/config/data-source.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,10 @@ export const dataSourceOptions: DataSourceOptions = {
};

export const dataSourceJest: DataSourceOptions = {
type: "mysql",
host: process.env.DB_HOST,
port: parseInt(process.env.DB_PORT, 10),
username: process.env.DB_USERNAME,
password: process.env.DB_PASSWORD,
database: process.env.DB_DATABASE,
timezone: process.env.DB_TIMEZONE,
type: "sqlite",
database: ":memory:",
entities: [UserEntity],
migrations: [__dirname + "/../database/migrations/*.js"],
extra: {
charset: "utf8mb4_unicode_ci",
},
synchronize: false,
logging: false,
synchronize: true,
};

const dataSource = new DataSource(dataSourceOptions);
Expand Down
Loading

0 comments on commit 96b1801

Please sign in to comment.