Skip to content

Commit

Permalink
add LabProcess tests, fix schematype of ROCrateObject base constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
kMutagene committed Sep 2, 2024
1 parent c8dd78c commit ef6c0e4
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/ROCrate/ROCrateObject.fs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type IROCrateObject =
type ROCrateObject(id:string, schemaType: string, ?additionalType) =
inherit DynamicObj()

let mutable _schemaType = "schema.org/Dataset"
let mutable _schemaType = schemaType
let mutable _additionalType = additionalType

member this.Id
Expand Down
53 changes: 49 additions & 4 deletions tests/ROCrate/ISAProfile/LabProcess.tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,63 @@ module Tests.LabProcess
open ARCtrl.ROCrate

open TestingUtils
open Common

let tests_profile_object_is_valid = testList "profile object is valid" []
let mandatory_properties = LabProcess(
id = "labprocess_mandatory_properties_id",
name = "name",
agent = "agent",
object = "object",
result = "result"
)

let tests_static_methods = testList "static methods" []
let all_properties = LabProcess(
id = "labprocess_all_properties_id",
name = "name",
agent = "agent",
object = "object",
result = "result",
additionalType = "additionalType",
executesLabProtocol = "executesLabProtocol",
parameterValue = "parameterValue",
endTime = "endTime",
disambiguatingDescription = "disambiguatingDescription"
)

let tests_interface_members = testList "interface members" []
let tests_profile_object_is_valid = testList "constructed properties" [
testList "mandatory properties" [
testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "labprocess_mandatory_properties_id" mandatory_properties
testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "bioschemas.org/LabProcess" mandatory_properties
testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" mandatory_properties
testCase "agent" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "agent" "agent" mandatory_properties
testCase "object" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "object" "object" mandatory_properties
testCase "result" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "result" "result" mandatory_properties
]
testList "all properties" [
testCase "Id" <| fun _ -> Expect.ROCrateObjectHasId "labprocess_all_properties_id" all_properties
testCase "SchemaType" <| fun _ -> Expect.ROCrateObjectHasType "bioschemas.org/LabProcess" all_properties
testCase "AdditionalType" <| fun _ -> Expect.ROCrateObjectHasAdditionalType "additionalType" all_properties
testCase "name" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "name" "name" all_properties
testCase "agent" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "agent" "agent" all_properties
testCase "object" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "object" "object" all_properties
testCase "result" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "result" "result" all_properties
testCase "executesLabProtocol" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "executesLabProtocol" "executesLabProtocol" all_properties
testCase "parameterValue" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "parameterValue" "parameterValue" all_properties
testCase "endTime" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "endTime" "endTime" all_properties
testCase "disambiguatingDescription" <| fun _ -> Expect.ROCrateObjectHasDynamicProperty "disambiguatingDescription" "disambiguatingDescription" all_properties

]
]

let tests_interface_members = testList "interface members" [
testCase "mandatoryProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "bioschemas.org/LabProcess" "labprocess_mandatory_properties_id" None mandatory_properties
testCase "allProperties" <| fun _ -> Expect.ROCrateObjectHasExpectedInterfaceMembers "bioschemas.org/LabProcess" "labprocess_all_properties_id" (Some "additionalType") all_properties
]

let tests_dynamic_members = testList "dynamic members" []

let main = testList "LabProcess" [
tests_profile_object_is_valid
tests_static_methods
tests_interface_members
tests_dynamic_members
]

0 comments on commit ef6c0e4

Please sign in to comment.