Page MenuHomeWildfire Games

Use IID_Health in test_Damage after rP22754.
ClosedPublic

Authored by Freagarach on Jun 5 2020, 9:15 AM.

Details

Summary

rP22754 Changed IID_DamageReceiver to IID_Resistance, which ought to be IID_Health in test_Damage.js. See rP22754#42632.

Test Plan

Run test, one can check that the functions *are* called now by inserting a warn or fiddling with values to make it fail.

Diff Detail

Repository
rP 0 A.D. Public Repository
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Freagarach created this revision.Jun 5 2020, 9:15 AM

Nice catch :)

I think you could usefully craft something with my new 'Spy' method to check that the functions are actually called.

let mock = AddMock(64, IID_Health, {
	"TakeDamage": (effectData, __, ___, mult) => {
		TS_ASSERT_EQUALS(mult * (effectData.Hack + effectData.Pierce + effectData.Crush), 0);
		return { "killed": false, "change": -mult * (effectData.Hack + effectData.Pierce + effectData.Crush) };
	}
});
let callSpy = new Spy(mock, "TakeDamage")

TS_ASSERT(callSpy._called == 1)

Maybe not useful for all of them.

Vulcan added a comment.Jun 5 2020, 9:40 AM

Successful build - Chance fights ever on the side of the prudent.

Link to build: https://jenkins.wildfiregames.com/job/docker-differential/2316/display/redirect

This revision was not accepted when it landed; it landed in state Needs Review.Jun 5 2020, 7:14 PM
This revision was automatically updated to reflect the committed changes.

Thanks for the commit @wraitii :)

ps/trunk/binaries/data/mods/public/simulation/components/tests/test_Damage.js
340

(cmpHealth; capital "H".)