Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F6084532
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()'
,
function
(
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()'
,
function
(
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()'
,
function
(
assert
)
{
assert
.
strictEqual
(
mw
.
eventLog
.
makeLegacyStreamName
(
'MySchema'
),
'eventlogging_MySchema'
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Oct 5 2026, 13:07 (7 w, 1 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
54/af/04df3fb38f328244ce0e30731d30
Default Alt Text
utils.test.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment