Skip to content

Commit

Permalink
Add tests for val input (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
adamrtalbot authored Apr 18, 2024
1 parent 03779fe commit 18895e9
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 22 deletions.
8 changes: 4 additions & 4 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"esbenp.prettier-vscode",
"redhat.vscode-yaml",
"GitHub.vscode-pull-request-github",
"github.vscode-github-actions",
],
},
},
"github.vscode-github-actions"
]
}
}
}
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,6 @@ Tests moving a file within the working directory.

Tests moving the contents of a folder to a new folder within the working directory.

```
### `TEST_VAL_INPUT`

```
Test a process can accept a value as input.
34 changes: 33 additions & 1 deletion main.nf
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,37 @@ process TEST_MV_FOLDER_CONTENTS {
"""
}

process TEST_STDOUT {
/*
This process should create and capture STDOUT
*/

output:
stdout

script:
"""
"""
}

process TEST_VAL_INPUT {
/*
This process should read in val and echo to STDOUT
*/


input:
val input

output:
stdout

script:
"""
echo $input
"""
}

workflow NF_CANARY {

main:
Expand All @@ -220,7 +251,8 @@ workflow NF_CANARY {
TEST_IGNORED_FAIL()
TEST_MV_FILE()
TEST_MV_FOLDER_CONTENTS()

TEST_VAL_INPUT("Hello World")

// POC of emitting the channel
Channel.empty()
.mix(
Expand Down
12 changes: 6 additions & 6 deletions tests/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ nextflow_pipeline{

then {
assert workflow.success
assert workflow.trace.tasks().size() == 13
assert workflow.trace.succeeded().size() == 12
assert workflow.trace.tasks().size() == 14
assert workflow.trace.succeeded().size() == 13
assert workflow.trace.failed().size() == 1
assert snapshot(workflow, path(params.outdir).list()).match()
}
Expand All @@ -34,8 +34,8 @@ nextflow_pipeline{

then {
assert workflow.success
assert workflow.trace.tasks().size() == 12
assert workflow.trace.succeeded().size() == 11
assert workflow.trace.tasks().size() == 13
assert workflow.trace.succeeded().size() == 12
assert workflow.trace.failed().size() == 1
assert snapshot(workflow, path(params.outdir).list()).match()
}
Expand Down Expand Up @@ -74,8 +74,8 @@ nextflow_pipeline{

then {
assert workflow.success
assert workflow.trace.tasks().size() == 13
assert workflow.trace.succeeded().size() == 12
assert workflow.trace.tasks().size() == 14
assert workflow.trace.succeeded().size() == 13
assert workflow.trace.failed().size() == 1
assert snapshot(workflow, path("${launchDir}/output").list()).match()
}
Expand Down
34 changes: 25 additions & 9 deletions tests/main.nf.test.snap
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
"errorMessage": "",
"trace": {
"tasksFailed": 1,
"tasksCount": 12,
"tasksSucceeded": 11
"tasksCount": 13,
"tasksSucceeded": 12
},
"name": "workflow",
"success": true
Expand All @@ -28,7 +28,11 @@
"test.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"timestamp": "2023-10-04T12:09:12.963778"
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-04-18T17:10:49.052904"
},
"Should publish to alternative directory": {
"content": [
Expand All @@ -45,8 +49,8 @@
"errorMessage": "",
"trace": {
"tasksFailed": 1,
"tasksCount": 13,
"tasksSucceeded": 12
"tasksCount": 14,
"tasksSucceeded": 13
},
"name": "workflow",
"success": true
Expand All @@ -59,7 +63,11 @@
"test.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"timestamp": "2023-10-04T12:20:22.461185"
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-04-18T17:10:53.086666"
},
"Should only run one process": {
"content": [
Expand All @@ -86,6 +94,10 @@

]
],
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2023-10-04T12:17:23.982939"
},
"Should run without failures": {
Expand All @@ -103,8 +115,8 @@
"errorMessage": "",
"trace": {
"tasksFailed": 1,
"tasksCount": 13,
"tasksSucceeded": 12
"tasksCount": 14,
"tasksSucceeded": 13
},
"name": "workflow",
"success": true
Expand All @@ -117,6 +129,10 @@
"test.txt:md5,d41d8cd98f00b204e9800998ecf8427e"
]
],
"timestamp": "2023-10-04T12:07:58.679961"
"meta": {
"nf-test": "0.8.4",
"nextflow": "23.10.1"
},
"timestamp": "2024-04-18T17:10:47.053474"
}
}

0 comments on commit 18895e9

Please sign in to comment.