# Automatically generated by openapi-generator (https://openapi-generator.tech)
# Please update as you see appropriate
context("Test SampleProcessing")
model.instance <- SampleProcessing$new()
ref.json <- '{
"id" : 1,
"sampleProcessing" : [ {
"id" : null,
"cv_label" : "MSIO",
"cv_accession" : "MSIO:0000148",
"name" : "high performance liquid chromatography",
"value" : null
},
{
"id" : null,
"cv_label" : "MSIO",
"cv_accession" : "MSIO:0000148",
"name" : "high performance liquid chromatography",
"value" : null
} ]
}'
test_that("sampleProcessing", {
model.instance <- model.instance$fromJSONString(ref.json)
expect_equal(model.instance$`id`, 1)
expect_equal(length(model.instance$`sampleProcessing`), 2)
expect_null(model.instance$`sampleProcessing`[[1]]$`id`)
expect_equal(model.instance$`sampleProcessing`[[1]]$`cv_label`, "MSIO")
expect_equal(model.instance$`sampleProcessing`[[1]]$`cv_accession`, "MSIO:0000148")
expect_equal(model.instance$`sampleProcessing`[[1]]$`name`, "high performance liquid chromatography")
expect_equal(model.instance$`sampleProcessing`[[1]]$`value`, NULL)
restored.model.instance <- SampleProcessing$new()
restored.model.instance$fromJSONString(model.instance$toJSONString())
expect_equal(model.instance, restored.model.instance)
})
test_that("sampleProcessing$toDataFrame()", {
model.instance <- model.instance$fromJSONString(ref.json)
df <- model.instance$toDataFrame()
expect_equal(df[1, "PREFIX"], "MTD")
expect_equal(df[1, "KEY"], "sample_processing[1]")
expect_equal(df[1, "VALUE"], "[MSIO, MSIO:0000148, high performance liquid chromatography, ]|[MSIO, MSIO:0000148, high performance liquid chromatography, ]")
})
test_that("sampleProcessing$fromDataFrame", {
sampleProcessingMtd <-
'MTD\tsample_processing[1]\t[MSIO, MSIO:0000148, high performance liquid chromatography, ]'
mzTabTable <- readMzTabString(sampleProcessingMtd)
metadataTable <- extractMetadata(mzTabTable)
idElements <- extractIdElements(metadataTable, "sample_processing", "param")
model.instance <- SampleProcessing$new()
model.instance$fromDataFrame(idElements[[1]])
expect_equal(model.instance$`id`, 1)
expect_equal(length(model.instance$`sampleProcessing`), 1)
expect_null(model.instance$`sampleProcessing`[[1]]$`id`)
expect_equal(model.instance$`sampleProcessing`[[1]]$`cv_label`, "MSIO")
expect_equal(model.instance$`sampleProcessing`[[1]]$`cv_accession`, "MSIO:0000148")
expect_equal(model.instance$`sampleProcessing`[[1]]$`name`, "high performance liquid chromatography")
expect_equal(model.instance$`sampleProcessing`[[1]]$`value`, NULL)
})
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.