Skip to content

Commit

Permalink
Added success case to cluster_file process test
Browse files Browse the repository at this point in the history
  • Loading branch information
kylacochrane committed Jun 7, 2024
1 parent b4cbd03 commit 6691dea
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/data/clusters/expected_clusters.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
id address level_1 level_2 level_3
sample1 1.1.1 1 1 1
sample2 1.1.1 1 1 1
sample3 2.2.2 2 2 2
sample3 1.1.2 1 1 2
31 changes: 30 additions & 1 deletion tests/modules/cluster_file/main.nf.test
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,35 @@ nextflow_process {
script "modules/local/cluster_file/main.nf"
process "CLUSTER_FILE"

test("Test when sample levels are equal") {

when {
process {
"""
input[0] = Channel.of(
[['id':'sample1', 'address':'1.1.1'],
['id':'sample2', 'address':'1.1.1'],
['id':'sample3', 'address':'1.1.2']]
)
"""
}

params {
outdir = "cluster_results"
}
}

then {
assert process.success
assert path("$launchDir/cluster_results").exists()

// Check expected_clusters
def actual_clusters = path("$launchDir/cluster_results/cluster/expected_clusters.txt")
def expected_clusters = path("$baseDir/tests/data/clusters/expected_clusters.txt")
assert actual_clusters.text == expected_clusters.text
}
}

test("Test when sample levels are different") {

when {
Expand All @@ -17,7 +46,7 @@ nextflow_process {
}

params {
outdir = "clusterfile_test_out"
outdir = "cluster_results"
}
}

Expand Down

0 comments on commit 6691dea

Please sign in to comment.