Page Menu
Home
WickedGov Phorge
Search
Configure Global Search
Log In
Files
F1426682
PageLanguageLinks.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
PageLanguageLinks.js
View Options
'use strict'
;
const
{
action
,
assert
,
REST
,
utils
}
=
require
(
'api-testing'
);
const
chai
=
require
(
'chai'
);
const
expect
=
chai
.
expect
;
const
chaiResponseValidator
=
require
(
'chai-openapi-response-validator'
).
default
;
describe
(
'Page language links'
,
()
=>
{
let
client
,
mindy
,
openApiSpec
;
const
baseEditText
=
"''Edit 1'' and '''Edit 2'''"
;
const
page
=
utils
.
title
(
'PageLanguageLinks_'
);
beforeEach
(
async
()
=>
{
mindy
=
await
action
.
mindy
();
await
mindy
.
edit
(
page
,
{
text
:
baseEditText
}
);
client
=
new
REST
(
'rest.php'
);
const
{
status
,
text
}
=
await
client
.
get
(
'/specs/v0/module/-'
);
assert
.
deepEqual
(
status
,
200
,
text
);
openApiSpec
=
JSON
.
parse
(
text
);
chai
.
use
(
chaiResponseValidator
(
openApiSpec
)
);
}
);
describe
(
'GET /page/{title}/links/language'
,
()
=>
{
it
(
'Should successfully return interlanguage links for the page'
,
async
()
=>
{
const
res
=
await
client
.
get
(
`/v1/page/
${
page
}
/links/language`
,
null
,
{
'accept-language'
:
'en-x-piglatin'
}
);
const
{
status
}
=
res
;
assert
.
deepEqual
(
status
,
200
);
// eslint-disable-next-line no-unused-expressions
expect
(
res
).
to
.
satisfyApiSpec
;
}
);
it
(
'Should return 404 for non existing page'
,
async
()
=>
{
const
dummyPageTitle
=
utils
.
title
(
'DummyPage_'
);
const
res
=
await
client
.
get
(
`/v1/page/
${
dummyPageTitle
}
/links/language`
);
const
{
status
}
=
res
;
assert
.
deepEqual
(
status
,
404
);
// eslint-disable-next-line no-unused-expressions
expect
(
res
).
to
.
satisfyApiSpec
;
}
);
}
);
}
);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sat, May 16, 13:33 (1 d, 14 h)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
bf/8d/551627d79511ae7578ebf6f917fb
Default Alt Text
PageLanguageLinks.js (1 KB)
Attached To
Mode
rMWPROD MediaWiki Production
Attached
Detach File
Event Timeline
Log In to Comment