Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F5989435
utils.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
utils.test.js
View Options
'use strict'
;
QUnit
.
module
(
'ext.eventLogging/utils'
);
QUnit
.
test
(
'pageviewInSample()'
,
(
assert
)
=>
{
assert
.
strictEqual
(
mw
.
eventLog
.
pageviewInSample
(
0
),
false
);
assert
.
strictEqual
(
mw
.
eventLog
.
pageviewInSample
(
1
),
true
);
// Test the rest using randomTokenMatch() since we don't
// want consistency in this case
}
);
QUnit
.
test
(
'sessionInSample()'
,
function
(
assert
)
{
const
mockRandomSession
=
function
()
{
// We know this is a multiple of 10
const
n
=
1000000000
;
return
n
.
toString
(
16
);
};
this
.
sandbox
.
stub
(
mw
.
user
,
'sessionId'
,
mockRandomSession
);
assert
.
strictEqual
(
mw
.
eventLog
.
sessionInSample
(
1
),
true
);
assert
.
strictEqual
(
mw
.
eventLog
.
sessionInSample
(
7
),
false
);
}
);
QUnit
.
test
(
'randomTokenMatch()'
,
(
assert
)
=>
{
const
n
=
1000000
,
m
=
1000001
;
assert
.
strictEqual
(
mw
.
eventLog
.
randomTokenMatch
(
10
,
n
.
toString
(
16
)
),
true
);
assert
.
strictEqual
(
mw
.
eventLog
.
randomTokenMatch
(
10
,
m
.
toString
(
16
)
),
false
);
}
);
QUnit
.
test
(
'makeLegacyStreamName()'
,
(
assert
)
=>
{
assert
.
strictEqual
(
mw
.
eventLog
.
makeLegacyStreamName
(
'MySchema'
),
'eventlogging_MySchema'
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Oct 4, 01:07 (3 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
07/ce/33596a4a89cea3e6b50b82c55c4a
Default Alt Text
utils.test.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment