Skip to content

Commit cb330ca

Browse files
committed
finish up first batch of cwl ro-crate parser tests
1 parent f9e657e commit cb330ca

2 files changed

Lines changed: 28 additions & 10 deletions

File tree

tests/ARCtrl/ROCrateConversion.Tests.fs

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ open TestingUtils
99
open ARCtrl.FileSystem
1010

1111
module Helper =
12+
13+
let tryLDRef (o : obj) =
14+
match o with
15+
| :? LDRef as r -> Some r
16+
| _ -> None
17+
1218
let tableName1 = "Test1"
1319
let tableName2 = "Test2"
1420
let oa_species = OntologyAnnotation("species", "GO", "GO:0123456")
@@ -1609,10 +1615,7 @@ let tests_FormalParameter =
16091615
]
16101616

16111617
let tests_YAMLInputValue =
1612-
let tryLDRef (o : obj) =
1613-
match o with
1614-
| :? LDRef as r -> Some r
1615-
| _ -> None
1618+
16161619
testList "YAMLInputValue" [
16171620
testCase "SimpleFileInRun" (fun () ->
16181621
let name = "MyInput"
@@ -1753,7 +1756,7 @@ let tests_ToolDescription =
17531756

17541757
let tests_WorkflowInvocation =
17551758
testList "WorkflowInvocation" [
1756-
ftestCase "OnlyCWL_BasicToolDescription" (fun () ->
1759+
testCase "OnlyCWL_BasicToolDescription" (fun () ->
17571760
let inputValues = ResizeArray [
17581761
TestObjects.CWL.YAMLParameterFile.File.fileParameterReference
17591762
TestObjects.CWL.YAMLParameterFile.String.stringParameterReference
@@ -1770,10 +1773,25 @@ let tests_WorkflowInvocation =
17701773
let objects = LDLabProcess.getObjects workflowInvocation
17711774
Expect.hasLength objects 2 "WorkflowInvocation should have two objects"
17721775

1773-
1774-
1775-
1776-
Expect.isFalse true "dawd"
1776+
let inputFile = Expect.wantSome (Seq.tryFind LDFile.validateCWLParameter objects) "Should have one input file"
1777+
let expectedFilePath = ArcPathHelper.combineMany [|"runs"; run.Identifier; TestObjects.CWL.YAMLParameterFile.File.filePath|]
1778+
Expect.equal inputFile.Id expectedFilePath "Input file path should match"
1779+
let exampleOfWork = Expect.wantSome (LDFile.tryGetExampleOfWork inputFile) "Input file should have an exampleOfWork"
1780+
let exampleOfWorkAsRef : LDRef = Expect.wantSome (tryLDRef exampleOfWork) "File ExampleOfWork should be a reference"
1781+
Expect.equal exampleOfWorkAsRef.Id $"#FormalParameter_R_{run.Identifier}_{TestObjects.CWL.Inputs.File.inputFileName}" "File ExampleOfWork ID should match input formal parameter"
1782+
1783+
let inputString = Expect.wantSome (Seq.tryFind LDPropertyValue.validateCWLParameter objects) "Should have one input string"
1784+
let inputStringValue = Expect.wantSome (LDPropertyValue.tryGetValueAsString inputString) "Input string should have a value"
1785+
Expect.equal inputStringValue TestObjects.CWL.YAMLParameterFile.String.stringValue "Input string value should match"
1786+
let exampleOfWork2 = Expect.wantSome (LDPropertyValue.tryGetExampleOfWork inputString) "Input string should have an exampleOfWork"
1787+
let exampleOfWorkAsRef2 : LDRef = Expect.wantSome (tryLDRef exampleOfWork2) "String ExampleOfWork should be a reference"
1788+
Expect.equal exampleOfWorkAsRef2.Id $"#FormalParameter_R_{run.Identifier}_{TestObjects.CWL.Inputs.String.inputStringName}" "String ExampleOfWork ID should match input formal parameter"
1789+
1790+
let results = LDLabProcess.getResults workflowInvocation
1791+
Expect.hasLength results 0 "WorkflowInvocation should have no results"
1792+
//let outputFile = Expect.wantSome (Seq.tryFind LDFile.validateCWLParameter results) "Should have one output file"
1793+
//let outputFileName = Expect.wantSome (LDFile.tryGetNameAsString outputFile) "Output file should have a name"
1794+
//Expect.equal outputFileName "runs/MyRun/output.csv" "Output file name should match"
17771795
)
17781796
]
17791797

tests/TestingUtils/TestObjects.CWL/YAMLParameterFile.fs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ exampleList:
1616
- baz.txt"""
1717

1818
module File =
19-
let filePath = "../examplePath"
19+
let filePath = "data/examplePath"
2020
let fileClass = "File"
2121

2222
let fileParameterReference = CWLParameterReference.create(key = Inputs.File.inputFileName, values = ResizeArray [filePath])

0 commit comments

Comments
 (0)