test_that("Testing method createModalFeedback() for WrongFeedback class", {
sut <- new ("ModalFeedback",outcome_identifier = "FEEDBACKMODAL",
show = TRUE,
identifier = "incorrect",
title = "Feedback wrong name",
content = list("
Text Feedback wrong
")
)
example <-"
Text Feedback wrong
"
sut <- xml2::read_xml(toString(createModalFeedback(sut)))
expected <- xml2::read_xml(example)
expect_equal(sut, expected)
})
test_that("Testing method createResponseCondition() for WrongFeedback class", {
sut <- wrongFeedback(show = FALSE, title = "Feedback wrong name",
content = list("Text Feedback wrong
")
)
example <-"
incorrect
incorrect
"
sut <- toString(htmltools::tag("additionalTag",
list(createResponseCondition(sut))))
sut <- xml2::read_xml(sut)
expected <- xml2::read_xml(example)
expect_equal(sut, expected)
})
test_that("Testing the constructor for WrongFeedback class", {
sut <- wrongFeedback(content = list("Some comments"), title = "Feedback")
xml_sut_1 <- createModalFeedback(sut)
xml_sut_2 <- createResponseCondition(sut)
expect_no_error(xml2::read_xml(as.character(xml_sut_1)))
expect_no_error(xml2::read_xml(as.character(xml_sut_2)))
expect_s4_class(sut, "WrongFeedback")
})
test_that("Testing the constructor for ModalFeedback class", {
sut <- modalFeedback(content = list("Model answer"), title = "Feedback")
xml_sut_1 <- createModalFeedback(sut)
xml_sut_2 <- createResponseCondition(sut)
expect_no_error(xml2::read_xml(as.character(xml_sut_1)))
expect_no_error(xml2::read_xml(as.character(xml_sut_2)))
expect_s4_class(sut, "ModalFeedback")
})