Commit 54130b40 authored by Peter van 't Hof's avatar Peter van 't Hof
Browse files

Added multisampleReport test

parent 0a883e99
{
"samples": {
"sampleName": {
"libraries": {
"libName": {
}
}
}
}
}
\ No newline at end of file
package nl.lumc.sasc.biopet.core.report
import java.io.File
import java.nio.file.Paths
import com.google.common.io.Files
import org.scalatest.Matchers
import org.scalatest.testng.TestNGSuite
import org.testng.annotations.Test
/**
* Created by pjvanthof on 24/02/16.
*/
class MultisampleReportBuilderTest extends TestNGSuite with Matchers {
private def resourcePath(p: String): String = {
Paths.get(getClass.getResource(p).toURI).toString
}
@Test
def testGeneratePages(): Unit = {
val builder = new MultisampleReportBuilder {
def reportName: String = "test"
def indexPage: ReportPage = ReportPage("Samples" -> generateSamplesPage(Map()) :: Nil, Nil, Map())
def samplePage(sampleId: String, args: Map[String, Any]): ReportPage =
ReportPage("Libraries" -> generateLibraryPage(Map("sampleId" -> Some(sampleId))) :: Nil, Nil, Map())
def libraryPage(sampleId: String, libraryId: String, args: Map[String, Any]) = ReportPage(Nil, Nil, Map())
}
val tempDir = Files.createTempDir()
tempDir.deleteOnExit()
val args = Array("-s", resourcePath("/empty_summary.json"), "-o", tempDir.getAbsolutePath)
builder.main(args)
builder.extFiles.foreach(x => new File(tempDir, "ext" + File.separator + x.targetPath) should exist)
new File(tempDir, "index.html") should exist
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment