diff --git a/src/nf_modules/BEDtools/bedtools.nf b/src/nf_modules/BEDtools/bedtools.nf
index 09ab4af1725b4afbee5affed191809368e1d1572..5c85aa6f8c162566d446a861451eea7fa86e70fa 100644
--- a/src/nf_modules/BEDtools/bedtools.nf
+++ b/src/nf_modules/BEDtools/bedtools.nf
@@ -21,7 +21,7 @@ Channel
   .set { bed_files }
 
 process fasta_from_bed {
-  tag "$pair_id"
+  tag "${bed.baseName}"
   cpus 4
   publishDir "results/fasta/", mode: 'copy'
 
@@ -35,6 +35,6 @@ process fasta_from_bed {
   script:
 """
 bedtools getfasta -name \
--fi ${fasta} -bed ${bed} -fo ${fasta.baseName}_extracted.fasta
+-fi ${fasta} -bed ${bed} -fo ${bed.baseName}_extracted.fasta
 """
 }
diff --git a/src/nf_modules/BEDtools/tests/fasta_from_bed.nf b/src/nf_modules/BEDtools/tests/fasta_from_bed.nf
new file mode 100644
index 0000000000000000000000000000000000000000..372f89e958f5fcf9256c37000f86e6b552e31def
--- /dev/null
+++ b/src/nf_modules/BEDtools/tests/fasta_from_bed.nf
@@ -0,0 +1,33 @@
+params.fastq = "$baseDir/data/fasta/*.fasta"
+params.bed = "$baseDir/data/annot/*.bed"
+
+log.info "fasta file : ${params.fasta}"
+log.info "bed file : ${params.bed}"
+
+Channel
+  .fromPath( params.fasta )
+  .ifEmpty { error "Cannot find any fasta files matching: ${params.fasta}" }
+  .set { fasta_files }
+Channel
+  .fromPath( params.bed )
+  .ifEmpty { error "Cannot find any bed files matching: ${params.bed}" }
+  .set { bed_files }
+
+process fasta_from_bed {
+  tag "${bed.baseName}"
+  cpus 4
+  publishDir "results/fasta/", mode: 'copy'
+
+  input:
+  file fasta from fasta_files
+  file bed from bed_files
+
+  output:
+  file "*_extracted.fasta" into fasta_files_extracted
+
+  script:
+"""
+bedtools getfasta -name \
+-fi ${fasta} -bed ${bed} -fo ${bed.baseName}_extracted.fasta
+"""
+}
diff --git a/src/nf_modules/BEDtools/tests/tests.sh b/src/nf_modules/BEDtools/tests/tests.sh
new file mode 100755
index 0000000000000000000000000000000000000000..f27c274f45cdf0fab1003f81986d96b29f50fdc2
--- /dev/null
+++ b/src/nf_modules/BEDtools/tests/tests.sh
@@ -0,0 +1,5 @@
+nextflow src/nf_modules/BEDtools/tests/fasta_from_bed.nf \
+  -c src/nf_modules/BEDtools/bedtools.config \
+  -profile docker \
+  --fasta "data/tiny_dataset/fasta/tiny_v2.fasta" \
+  --bed "data/tiny_dataset/annot/tiny.bed" \