fix(test): prune leftover task duplicates
This commit is contained in:
parent
e63b349b5f
commit
46b4f65da0
|
|
@ -2,6 +2,7 @@ import {createFakeUserAndLogin} from '../../support/authenticateUser'
|
|||
import {ProjectFactory} from '../../factories/project'
|
||||
import {TaskFactory} from '../../factories/task'
|
||||
import {ProjectViewFactory} from '../../factories/project_view'
|
||||
import {TaskRelationFactory} from '../../factories/task_relation'
|
||||
|
||||
function createViews(projectId: number, projectViewId: number) {
|
||||
return ProjectViewFactory.create(1, {
|
||||
|
|
@ -20,10 +21,11 @@ describe('Subtask duplicate handling', () => {
|
|||
let parentB
|
||||
let subtask
|
||||
|
||||
beforeEach(() => {
|
||||
ProjectFactory.truncate()
|
||||
ProjectViewFactory.truncate()
|
||||
TaskFactory.truncate()
|
||||
beforeEach(() => {
|
||||
ProjectFactory.truncate()
|
||||
ProjectViewFactory.truncate()
|
||||
TaskFactory.truncate()
|
||||
TaskRelationFactory.truncate()
|
||||
|
||||
projectA = ProjectFactory.create(1, {id: 1, title: 'Project A'})[0]
|
||||
createViews(projectA.id, 1)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
import {Factory} from '../support/factory'
|
||||
|
||||
export class TaskRelationFactory extends Factory {
|
||||
static table = 'task_relations'
|
||||
|
||||
static factory() {
|
||||
const now = new Date()
|
||||
|
||||
return {
|
||||
id: '{increment}',
|
||||
task_id: '{increment}',
|
||||
other_task_id: '{increment}',
|
||||
relation_kind: 'related',
|
||||
created_by_id: 1,
|
||||
created: now.toISOString(),
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue