HenrikSydow / rpg_engine

A simple rpg game engine written in typescript.
1 stars 0 forks source link

add mocks to test framework #31

Open HenrikSydow opened 1 year ago

HenrikSydow commented 1 year ago

Implement a way to easily instantiate mock objects. Maybe provide a way to create fake factories instead. (simpler implementation, more control)

HenrikSydow commented 1 year ago

Example for creating a mock Image class:

if (Image == null) {  // checks if global var, containing image supplied by dom is not defined
    var Image = MockImage as any;
}

"Normal" classes do not need a check for null, since they should already be defined.