Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1431494
statsv.test.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
statsv.test.js
View Options
import
*
as
stubs
from
'./../stubs'
;
import
{
isEnabled
}
from
'../../../src/instrumentation/statsv'
;
QUnit
.
module
(
'ext.popups/instrumentation/statsv'
);
QUnit
.
test
(
'#isEnabled'
,
function
(
assert
)
{
const
user
=
stubs
.
createStubUser
(),
config
=
stubs
.
createStubMap
(),
weightedBooleanStub
=
this
.
sandbox
.
stub
(),
experiments
=
{
weightedBoolean
:
weightedBooleanStub
};
config
.
set
(
'wgPopupsStatsvSamplingRate'
,
0.3141
);
isEnabled
(
user
,
config
,
experiments
);
assert
.
strictEqual
(
weightedBooleanStub
.
callCount
,
1
,
'The experiments object is called.'
);
assert
.
deepEqual
(
weightedBooleanStub
.
getCall
(
0
).
args
,
[
'ext.Popups.statsv'
,
config
.
get
(
'wgPopupsStatsvSamplingRate'
),
user
.
sessionId
()
],
'The experiments object is called with the correct arguments.'
);
// ---
config
.
delete
(
'wgPopupsStatsvSamplingRate'
);
const
defaultResult
=
isEnabled
(
user
,
config
,
experiments
);
assert
.
strictEqual
(
defaultResult
,
false
,
'The bucketing is disabled by default.'
);
assert
.
strictEqual
(
weightedBooleanStub
.
callCount
,
1
,
'The experiments object is not called when bucketing rate is the default 0.'
);
}
);
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sat, May 16, 20:37 (1 d, 5 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
39/37/3aea1893d3896ae8bb4b4f2bb6b8
Default Alt Text
statsv.test.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment