Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4103537
kvStore.tests.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
kvStore.tests.js
View Options
(
function
()
{
var
realIdleCallback
=
mw
.
requestIdleCallback
;
QUnit
.
module
(
'ext.centralNotice.kvStore'
,
QUnit
.
newMwEnvironment
(
{
afterEach
:
function
()
{
var
key
,
i
=
localStorage
.
length
;
// Loop backwards since removal affects the key index,
// causing items to consistently be skipped over
while
(
i
--
>
0
)
{
key
=
localStorage
.
key
(
i
);
if
(
/^CentralNoticeKV.+\|unittest/
.
test
(
key
)
)
{
localStorage
.
removeItem
(
key
);
}
}
mw
.
requestIdleCallback
=
realIdleCallback
;
}
}
)
);
QUnit
.
test
(
'getItem'
,
function
(
assert
)
{
var
kvStore
=
mw
.
centralNotice
.
kvStore
,
context
=
kvStore
.
contexts
.
GLOBAL
;
kvStore
.
setItem
(
'unittest-New'
,
'x'
,
context
,
1
);
kvStore
.
setItem
(
'unittest-Old'
,
'x'
,
context
,
-
2
);
assert
.
strictEqual
(
kvStore
.
getError
(),
null
,
'no errors'
);
assert
.
strictEqual
(
kvStore
.
getItem
(
'unittest-New'
,
context
),
'x'
,
'retrieve valid item'
);
// Verify that expiry is verified at run-time regardless of kvStoreMaintenance
assert
.
strictEqual
(
kvStore
.
getItem
(
'unittest-Old'
,
context
),
null
,
'ignore expired item'
);
}
);
}()
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Aug 18, 18:02 (3 w, 3 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
d0/af/208d374017b7de0082cd81b881ba
Default Alt Text
kvStore.tests.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment