OptionItemの作成が重複してしまっていたので片方を削除
タスク削除のテストをMysql使用するように修正
This commit is contained in:
parent
3877a4670d
commit
63191a3b61
@ -4120,20 +4120,32 @@ describe('getNextTask', () => {
|
||||
|
||||
describe('deleteTask', () => {
|
||||
let source: DataSource | null = null;
|
||||
beforeAll(async () => {
|
||||
if (source == null) {
|
||||
source = await (async () => {
|
||||
const s = new DataSource({
|
||||
type: 'mysql',
|
||||
host: 'test_mysql_db',
|
||||
port: 3306,
|
||||
username: 'user',
|
||||
password: 'password',
|
||||
database: 'odms',
|
||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||
synchronize: false, // trueにすると自動的にmigrationが行われるため注意
|
||||
});
|
||||
return await s.initialize();
|
||||
})();
|
||||
}
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
source = new DataSource({
|
||||
type: 'sqlite',
|
||||
database: ':memory:',
|
||||
logging: false,
|
||||
entities: [__dirname + '/../../**/*.entity{.ts,.js}'],
|
||||
synchronize: true, // trueにすると自動的にmigrationが行われるため注意
|
||||
});
|
||||
return source.initialize();
|
||||
if (source) {
|
||||
await truncateAllTable(source);
|
||||
}
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
if (!source) return;
|
||||
await source.destroy();
|
||||
afterAll(async () => {
|
||||
await source?.destroy();
|
||||
source = null;
|
||||
});
|
||||
|
||||
|
||||
@ -158,59 +158,6 @@ export const createTask = async (
|
||||
});
|
||||
const task = taskIdentifiers.pop() as Task;
|
||||
|
||||
await datasource.getRepository(AudioOptionItem).insert([
|
||||
{
|
||||
audio_file_id: audioFile.id,
|
||||
label: 'label01',
|
||||
value: 'value01',
|
||||
},
|
||||
{
|
||||
audio_file_id: audioFile.id,
|
||||
label: 'label02',
|
||||
value: 'value02',
|
||||
},
|
||||
{
|
||||
audio_file_id: audioFile.id,
|
||||
label: 'label03',
|
||||
value: 'value03',
|
||||
},
|
||||
{
|
||||
audio_file_id: audioFile.id,
|
||||
label: 'label04',
|
||||
value: 'value04',
|
||||
},
|
||||
{
|
||||
audio_file_id: audioFile.id,
|
||||
label: 'label05',
|
||||
value: 'value05',
|
||||
},
|
||||
{
|
||||
audio_file_id: audioFile.id,
|
||||
label: 'label06',
|
||||
value: 'value06',
|
||||
},
|
||||
{
|
||||
audio_file_id: audioFile.id,
|
||||
label: 'label07',
|
||||
value: 'value07',
|
||||
},
|
||||
{
|
||||
audio_file_id: audioFile.id,
|
||||
label: 'label08',
|
||||
value: 'value08',
|
||||
},
|
||||
{
|
||||
audio_file_id: audioFile.id,
|
||||
label: 'label09',
|
||||
value: 'value09',
|
||||
},
|
||||
{
|
||||
audio_file_id: audioFile.id,
|
||||
label: 'label10',
|
||||
value: 'value10',
|
||||
},
|
||||
]);
|
||||
|
||||
return { taskId: task.id, audioFileId: audioFile.id };
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user