mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-06 06:52:39 +00:00
## About The Pull Request I borked carg with my black market refactor, and nobody really noticed because we don't have a unit test to detect the issue. This PR is aimed to fix #81987 and prevent similar accidents in the future. ## Why It's Good For The Game See above. ## Changelog 🆑 fix: FIXED CARGO EXPORTS! /🆑
35 lines
1.4 KiB
Plaintext
35 lines
1.4 KiB
Plaintext
/// Makes sure exports work and things can be sold
|
|
/datum/unit_test/cargo_selling
|
|
|
|
/obj/item/cargo_unit_test_container
|
|
|
|
/obj/item/cargo_unit_test_container/Initialize(mapload)
|
|
. = ..()
|
|
new /obj/item/cargo_unit_test_content(src)
|
|
|
|
/obj/item/cargo_unit_test_content
|
|
|
|
/datum/export/cargo_unit_test_container
|
|
cost = PAYCHECK_LOWER
|
|
export_types = list(/obj/item/cargo_unit_test_container)
|
|
|
|
/datum/export/cargo_unit_test_content
|
|
cost = PAYCHECK_COMMAND
|
|
export_types = list(/obj/item/cargo_unit_test_content)
|
|
|
|
/datum/unit_test/cargo_selling/Run()
|
|
var/obj/item/cargo_unit_test_container/box = allocate(/obj/item/cargo_unit_test_container)
|
|
var/obj/item/cargo_unit_test_container/box_skip_content = allocate(/obj/item/cargo_unit_test_container)
|
|
|
|
var/datum/export_report/report_one = export_item_and_contents(box, apply_elastic = FALSE)
|
|
if(isnull(report_one))
|
|
TEST_FAIL("called 'export_item_and_contents', but no export report was returned.")
|
|
var/value = counterlist_sum(report_one.total_value)
|
|
TEST_ASSERT_EQUAL(value, PAYCHECK_LOWER + PAYCHECK_COMMAND, "'export_item_and_contents' value didn't match expected value")
|
|
|
|
var/datum/export_report/report_two = export_single_item(box_skip_content, apply_elastic = FALSE)
|
|
if(isnull(report_two))
|
|
TEST_FAIL("called 'export_single_item', but no export report was returned.")
|
|
value = counterlist_sum(report_two.total_value)
|
|
TEST_ASSERT_EQUAL(value, PAYCHECK_LOWER, "'export_single_item' value didn't match expected value")
|