Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4145953
experiments.test.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
918 B
Referenced Files
None
Subscribers
None
experiments.test.js
View Options
import
createExperiments
from
'../../src/experiments'
;
QUnit
.
module
(
'ext.popups/experiments#weightedBoolean'
);
QUnit
.
test
(
'it should call mw.experiments#getBucket'
,
function
(
assert
)
{
const
getBucketStub
=
this
.
sandbox
.
stub
(),
stubMWExperiments
=
{
getBucket
:
getBucketStub
},
experiments
=
createExperiments
(
stubMWExperiments
);
experiments
.
weightedBoolean
(
'foo'
,
0.2
,
'barbaz'
);
assert
.
strictEqual
(
getBucketStub
.
callCount
,
1
,
'The bucketer was invoked once.'
);
assert
.
deepEqual
(
getBucketStub
.
getCall
(
0
).
args
,
[
{
enabled
:
true
,
name
:
'foo'
,
buckets
:
{
true
:
0.2
,
false
:
0.8
// 1 - 0.2
}
},
'barbaz'
],
'The bucketer was called with the correct arguments.'
);
// ---
getBucketStub
.
returns
(
'true'
);
assert
.
true
(
experiments
.
weightedBoolean
(
'foo'
,
0.2
,
'barbaz'
),
'It should return true if the bucket is "true".'
);
}
);
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Aug 19 2026, 17:50 (5 w, 5 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
2e/40/1c020cd472c133f33e08728abe90
Default Alt Text
experiments.test.js (918 B)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment