phaser
Version:
A fast, free and fun HTML5 Game Framework for Desktop and Mobile web browsers from the team at Phaser Studio Inc.
29 lines (26 loc) • 968 B
JavaScript
/**
* NineSliceFactory.test.js
*
* NineSliceFactory.js registers a factory method on GameObjectFactory and
* relies on the WEBGL_RENDERER webpack define, the NineSlice class (which
* requires a full WebGL/scene context), and GameObjectFactory (which is
* tightly coupled to the Phaser scene system). None of these can be
* exercised without a running Phaser game instance, so only an import
* smoke-test is possible here.
*/
describe('NineSliceFactory', function ()
{
it('should be importable without throwing', function ()
{
// WEBGL_RENDERER is a webpack define that does not exist in Node.js.
// Defining it here prevents a ReferenceError when the module is loaded.
if (typeof WEBGL_RENDERER === 'undefined')
{
global.WEBGL_RENDERER = true;
}
expect(function ()
{
require('../../../src/gameobjects/nineslice/NineSliceFactory');
}).not.toThrow();
});
});