Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F4100442
Delete.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
Delete.js
View Options
'use strict'
;
const
{
action
,
assert
,
utils
}
=
require
(
'api-testing'
);
describe
(
'The delete/undelete action'
,
()
=>
{
const
title
=
utils
.
title
(
'Delete_'
);
let
alice
,
mindy
;
before
(
async
()
=>
{
[
alice
,
mindy
]
=
await
Promise
.
all
(
[
action
.
alice
(),
action
.
mindy
()
]
);
}
);
it
(
'allows an admin to delete a page'
,
async
()
=>
{
await
alice
.
edit
(
title
,
{
text
:
'Testing the testy test'
,
summary
:
'first'
,
createonly
:
true
}
);
const
result
=
await
mindy
.
action
(
'delete'
,
{
title
,
summary
:
'testing'
,
token
:
await
mindy
.
token
(
'csrf'
)
},
'POST'
);
assert
.
sameTitle
(
result
.
delete
.
title
,
title
);
const
error
=
await
mindy
.
actionError
(
'parse'
,
{
page
:
title
}
);
assert
.
equal
(
error
.
code
,
'missingtitle'
);
}
);
it
(
'logs the deletion'
,
async
()
=>
{
const
log
=
await
alice
.
getLogEntry
(
{
letype
:
'delete'
,
letitle
:
title
}
);
assert
.
equal
(
log
.
user
,
mindy
.
username
);
assert
.
equal
(
log
.
action
,
'delete'
);
}
);
it
(
'allows an admin to undelete a page'
,
async
()
=>
{
const
result
=
await
mindy
.
action
(
'undelete'
,
{
title
,
summary
:
'testing'
,
token
:
await
mindy
.
token
(
'csrf'
)
},
'POST'
);
assert
.
sameTitle
(
result
.
undelete
.
title
,
title
);
const
html
=
await
alice
.
getHtml
(
title
);
assert
.
match
(
html
,
/Testing the testy test/
);
}
);
it
(
'logs the undeletion'
,
async
()
=>
{
const
log
=
await
alice
.
getLogEntry
(
{
letype
:
'delete'
,
letitle
:
title
}
);
assert
.
equal
(
log
.
user
,
mindy
.
username
);
assert
.
equal
(
log
.
action
,
'restore'
);
}
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Aug 18, 16:24 (3 w, 4 d ago)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
01/d9/8e73dff0367b02e61d3c2e9555d4
Default Alt Text
Delete.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment