current step Id per record
This commit is contained in:
@@ -2,12 +2,13 @@ import { toISODate } from '@/shared/types/date'
|
||||
import { faker } from '@faker-js/faker'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
import type { Recordable } from '../interfaces/recordable'
|
||||
import { fixtureRecordable } from '../interfaces/recordable.fixture'
|
||||
import { fixtureTimeRange } from '../interfaces/time-range.fixture'
|
||||
import { TaskRecord } from './task-record'
|
||||
|
||||
describe('Task Record', () => {
|
||||
it('creates a Record from a Recordable', () => {
|
||||
const recordable: Recordable = {
|
||||
const recordable: Recordable = fixtureRecordable({
|
||||
taskId: faker.datatype.uuid(),
|
||||
notes: faker.lorem.paragraphs(),
|
||||
start: toISODate(faker.date.past(1)),
|
||||
@@ -16,7 +17,7 @@ describe('Task Record', () => {
|
||||
stepRecords: {
|
||||
[faker.datatype.uuid()]: fixtureTimeRange()
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
expect(TaskRecord.fromRecordable(recordable)).toEqual(recordable)
|
||||
})
|
||||
|
||||
@@ -8,6 +8,7 @@ export class TaskRecord implements Recordable {
|
||||
public stepRecords: Record<string, TimeRange> = {}
|
||||
public notes = ''
|
||||
public breakTime?: TimeRange
|
||||
public currentStepId: string | null = null
|
||||
|
||||
public constructor(public readonly taskId: string) {}
|
||||
|
||||
@@ -19,6 +20,7 @@ export class TaskRecord implements Recordable {
|
||||
const taskRecord = new TaskRecord(recordable.taskId)
|
||||
|
||||
taskRecord.stepRecords = recordable.stepRecords
|
||||
taskRecord.currentStepId = recordable.currentStepId
|
||||
taskRecord.start = recordable.start
|
||||
taskRecord.end = recordable.end
|
||||
taskRecord.breakTime = recordable.breakTime
|
||||
|
||||
Reference in New Issue
Block a user