Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4157503
moduleLoader.test.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
moduleLoader.test.js
View Options
let
ModuleLoader
;
const
oo
=
require
(
'../utils/oo'
),
sinon
=
require
(
'sinon'
);
/** @type {sinon.SinonSandbox} */
let
sandbox
;
QUnit
.
module
(
'MobileFrontend ModuleLoader'
,
{
beforeEach
:
function
()
{
sandbox
=
sinon
.
sandbox
.
create
();
oo
.
setUp
(
sandbox
,
global
);
ModuleLoader
=
require
(
'../../../src/mobile.startup/moduleLoader'
);
this
.
loader
=
new
ModuleLoader
();
},
afterEach
:
function
()
{
sandbox
.
restore
();
}
}
);
QUnit
.
test
(
'#require'
,
function
(
assert
)
{
this
.
loader
.
define
(
'foo'
,
1
);
this
.
loader
.
define
(
'bar'
,
5
);
assert
.
strictEqual
(
this
.
loader
.
require
(
'foo'
),
1
,
'Returns appropriate module'
);
assert
.
strictEqual
(
this
.
loader
.
require
(
'bar'
),
5
,
'Returns appropriate module'
);
assert
.
throws
(
function
()
{
this
.
loader
.
require
(
'undefinedmodule'
);
},
'Cannot require an undefined module.'
);
assert
.
throws
(
function
()
{
this
.
loader
.
require
(
'mobile.modules/Foo'
);
},
'Cannot require an undefined export on a known module.'
);
}
);
QUnit
.
test
(
'#define'
,
function
(
assert
)
{
const
loader
=
this
.
loader
;
loader
.
define
(
'foo'
,
1
);
loader
.
define
(
'bar'
,
5
);
assert
.
throws
(
function
()
{
loader
.
define
(
'bar'
,
50
);
},
'Cannot define two modules with the same name'
);
assert
.
strictEqual
(
this
.
loader
.
require
(
'bar'
),
5
,
'Returns first definition of module.'
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Aug 19 2026, 22:52 (8 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
5a/7f/5743b7142a62004ac54b4a80b792
Default Alt Text
moduleLoader.test.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment