-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #72 from nextflow-io/email-support
add missing depedency for email format support
- Loading branch information
Showing
4 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1093,4 +1093,56 @@ class ValidateParametersTest extends Dsl2Spec{ | |
!stdout | ||
} | ||
|
||
def 'should validate an email' () { | ||
given: | ||
def schema = Path.of('src/testResources/nextflow_schema.json').toAbsolutePath().toString() | ||
def SCRIPT = """ | ||
params.input = 'src/testResource/samplesheet.csv' | ||
params.outdir = 'src/testResources/testDir' | ||
params.email = "[email protected]" | ||
include { validateParameters } from 'plugin/nf-schema' | ||
validateParameters(parameters_schema: '$schema') | ||
""" | ||
|
||
when: | ||
def config = [:] | ||
def result = new MockScriptRunner(config).setScript(SCRIPT).execute() | ||
def stdout = capture | ||
.toString() | ||
.readLines() | ||
.findResults {it.contains('WARN nextflow.validation.SchemaValidator') || it.startsWith('* --') ? it : null } | ||
|
||
then: | ||
noExceptionThrown() | ||
!stdout | ||
} | ||
|
||
def 'should validate an email - failure' () { | ||
given: | ||
def schema = Path.of('src/testResources/nextflow_schema.json').toAbsolutePath().toString() | ||
def SCRIPT = """ | ||
params.input = 'src/testResource/samplesheet.csv' | ||
params.outdir = 'src/testResources/testDir' | ||
params.email = "thisisnotanemail" | ||
include { validateParameters } from 'plugin/nf-schema' | ||
validateParameters(parameters_schema: '$schema') | ||
""" | ||
|
||
when: | ||
def config = [:] | ||
def result = new MockScriptRunner(config).setScript(SCRIPT).execute() | ||
def stdout = capture | ||
.toString() | ||
.readLines() | ||
.findResults {it.contains('WARN nextflow.validation.SchemaValidator') || it.startsWith('* --') ? it : null } | ||
|
||
|
||
then: | ||
def error = thrown(SchemaValidationException) | ||
error.message.contains("* --email (thisisnotanemail): \"thisisnotanemail\" is not a valid email address") | ||
!stdout | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters