Skip to content

Commit

Permalink
test(gxf2bed): Add basic tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edmundmiller committed Feb 19, 2024
1 parent 71744db commit ab4d057
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 26 deletions.
6 changes: 3 additions & 3 deletions modules/nf-core/gxf2bed/main.nf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
process GXF2BED {
tag '$bam'
tag '$gxf.baseName'
label 'process_low'

conda "${moduleDir}/environment.yml"
Expand All @@ -18,7 +18,7 @@ process GXF2BED {
task.ext.when == null || task.ext.when

script:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${gxf.baseName}"
"""
gxf2bed \\
--input $gxf \\
Expand All @@ -32,7 +32,7 @@ process GXF2BED {
"""

stub:
def args = task.ext.args ?: ''
def prefix = task.ext.prefix ?: "${gxf.baseName}"
"""
touch ${prefix}.bed
Expand Down
43 changes: 20 additions & 23 deletions modules/nf-core/gxf2bed/tests/main.nf.test
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// TODO nf-core: Once you have added the required tests, please run the following command to build this file:
// nf-core modules test gxf2bed
nextflow_process {

name "Test Process GXF2BED"
Expand All @@ -10,20 +8,11 @@ nextflow_process {
tag "modules_nfcore"
tag "gxf2bed"

// TODO nf-core: Change the test name preferably indicating the test-data and file-format used
test("sarscov2 - bam") {

// TODO nf-core: If you are created a test for a chained module
// (the module requires running more than one process to generate the required output)
// add the 'setup' method here.
// You can find more information about how to use a 'setup' method in the docs (https://nf-co.re/docs/contributing/modules#steps-for-creating-nf-test-for-chained-modules).

test("sarscov2 - gtf") {
when {
process {
"""
// TODO nf-core: define inputs of the process here. Example:
input[0] = file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true)
input[0] = file(params.test_data['sarscov2']['genome']['genome_gtf'], checkIfExists: true)
"""
}
}
Expand All @@ -32,24 +21,18 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
//TODO nf-core: Add all required assertions to verify the test output.
// See https://nf-co.re/docs/contributing/tutorials/nf-test_assertions for more information and examples.
)
}

}

// TODO nf-core: Change the test name preferably indicating the test-data and file-format used but keep the " - stub" suffix.
test("sarscov2 - bam - stub") {
test("sarscov2 - gtf - stub") {

options "-stub"

when {
process {
"""
// TODO nf-core: define inputs of the process here. Example:
input[0] = file(params.test_data['sarscov2']['illumina']['test_single_end_bam'], checkIfExists: true)
input[0] = file(params.test_data['sarscov2']['genome']['genome_gtf'], checkIfExists: true)
"""
}
}
Expand All @@ -58,10 +41,24 @@ nextflow_process {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
//TODO nf-core: Add all required assertions to verify the test output.
)
}

}

test("sarscov2 - gff") {
when {
process {
"""
input[0] = file(params.test_data['homo_sapiens']['genome']['genome_gff3'], checkIfExists: true)
"""
}
}

then {
assertAll(
{ assert process.success },
{ assert snapshot(process.out).match() }
)
}
}
}

0 comments on commit ab4d057

Please sign in to comment.