1
0
Fork 0
mirror of https://github.com/pnx/neotest-phpunit synced 2026-06-16 03:54:55 +02:00

Add test for single result

This commit is contained in:
Michael Utz 2022-11-16 22:19:35 +03:00
parent c017340679
commit f2e87a2f99

View file

@ -1,8 +1,9 @@
local utils = require("neotest-pest.utils")
describe("get_test_results", function()
local output_file = "/tmp/nvimhYaIPj/3"
it("parses output with whole file", function()
local output_file = "/tmp/nvimhYaIPj/3"
local xml_output = {
testsuites = {
testsuite = {
@ -163,4 +164,56 @@ describe("get_test_results", function()
assert.are.same(utils.get_test_results(xml_output, output_file), expected)
end)
it('parses output with single test', function()
local xml_output = {
testsuites = {
testsuite = {
_attr = {
assertions = "3",
errors = "0",
failures = "0",
name = "/Users/michaelutz/Code/neotest-pest/tests/Feature/UserTest.php",
skipped = "0",
tests = "1",
time = "0.004366",
warnings = "0"
},
testsuite = {
_attr = {
assertions = "3",
errors = "0",
failures = "0",
file = "/Users/michaelutz/Code/neotest-pest/tests/Feature/UserTest.php",
name = "P\\Tests\\Feature\\UserTest",
skipped = "0",
tests = "1",
time = "0.004366",
warnings = "0"
},
testcase = {
_attr = {
assertions = "3",
class = "Tests\\Feature\\UserTest",
classname = "Tests.Feature.UserTest",
file = "/Users/michaelutz/Code/neotest-pest/tests/Feature/UserTest.php",
name = "addFavoriteMovie",
time = "0.004366"
}
}
}
}
}
}
local expected = {
["/Users/michaelutz/Code/neotest-pest/tests/Feature/UserTest.php::addFavoriteMovie"] = {
output_file = output_file,
short = "TESTS.FEATURE.USERTEST\n-> PASSED - addFavoriteMovie",
status = "passed"
}
}
assert.are.same(utils.get_test_results(xml_output, output_file), expected)
end)
end)