Skip to content

Commit

Permalink
fix: add meta info to Case class (#45)
Browse files Browse the repository at this point in the history
  • Loading branch information
maraberg authored Sep 20, 2024
1 parent 1bb9b79 commit caa864f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/case.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import {
ExperimentId,
FmuId,
WorkspaceId,
CaseMeta,
} from './types'
import Api from './api'
import ModelExecutable from './model-executable'
Expand All @@ -15,6 +16,7 @@ class Case {
private fmuId?: FmuId
id: CaseId
runInfo: CaseRunInfo
meta: CaseMeta
private workspaceId: WorkspaceId

constructor({
Expand All @@ -23,19 +25,22 @@ class Case {
fmuId,
id,
runInfo,
meta,
workspaceId,
}: {
api: Api
id: CaseId
fmuId?: FmuId
experimentId: ExperimentId
runInfo: CaseRunInfo
meta: CaseMeta
workspaceId: WorkspaceId
}) {
this.api = api
this.fmuId = fmuId
this.id = id
this.runInfo = runInfo
this.meta = meta
this.experimentId = experimentId
this.workspaceId = workspaceId
}
Expand Down
1 change: 1 addition & 0 deletions src/experiment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class Experiment {
fmuId: caseResponse.input.fmu_id,
id: caseResponse.id || i.toString(),
runInfo: caseResponse.run_info,
meta: caseResponse.meta,
workspaceId: this.workspaceId,
})
)
Expand Down
2 changes: 2 additions & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ export type CaseRunInfo = NonNullable<
>['items']
>[0]['run_info']

export type CaseMeta = Case["meta"];

export type ExperimentRunInfo =
components['schemas']['ExperimentItemV3']['run_info']

Expand Down
1 change: 1 addition & 0 deletions tests/integration/integration.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ test(
}

expect(cases[0].runInfo).toMatchObject({ status: 'successful' })
expect(cases[0].meta).toMatchObject({ label: null, orchestrator: false })

const log = await cases[0].getLog()
expect(typeof log).toBe('string')
Expand Down

0 comments on commit caa864f

Please sign in to comment.