Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1426604
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
Sat, May 16, 13:28 (1 d, 19 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
54/a0/326fd59631a2301864ba10f4b77c
Default Alt Text
utils.test.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment