diff options
author | SomeRandomDeveloper <thisisnotmyname275@gmail.com> | 2024-11-10 21:09:06 +0100 |
---|---|---|
committer | SomeRandomDeveloper <thisisnotmyname275@gmail.com> | 2024-11-26 13:08:44 +0100 |
commit | c372911c438051178d797ec39a2cdbccb2a13f52 (patch) | |
tree | 035f1e414500c3501ae0a64fc05081716d253ebe /tests/api-testing/REST/Search.js | |
parent | b3a0d28d98fdbe22f115724b37d8d459381ec7ee (diff) | |
download | mediawikicore-c372911c438051178d797ec39a2cdbccb2a13f52.tar.gz mediawikicore-c372911c438051178d797ec39a2cdbccb2a13f52.zip |
Add a warning when trying to create a broken redirect
Shows a warning when trying to create a redirect that points to a nonexistent page.
Update api tests to create the targets before the redirects.
Bug: T326057
Change-Id: Ib530f17527aa8e14b8865086faa8d9feff6116ef
Diffstat (limited to 'tests/api-testing/REST/Search.js')
-rw-r--r-- | tests/api-testing/REST/Search.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/api-testing/REST/Search.js b/tests/api-testing/REST/Search.js index 709725d9df4b..34138c0688ad 100644 --- a/tests/api-testing/REST/Search.js +++ b/tests/api-testing/REST/Search.js @@ -111,12 +111,12 @@ describe( 'Search', () => { const redirectTarget = utils.title( 'redirect_target_' ); const uniquePageText = utils.uniq(); + const { title: redirectTargetTitle } = await alice.edit( redirectTarget, { text: `${ uniquePageText }` } ); + await alice.edit( redirectSource, { text: `#REDIRECT [[ ${ redirectTarget } ]]. ${ uniquePageText }.` } ); - const { title: redirectTargetTitle } = await alice.edit( redirectTarget, { text: `${ uniquePageText }` } ); - await wiki.runAllJobs(); const { body, headers } = await client.get( `/search/page?q=${ uniquePageText }` ); assert.match( headers[ 'content-type' ], /^application\/json/ ); @@ -186,11 +186,12 @@ describe( 'Search', () => { const redirectSource = utils.title( 'redirect_source_' ); const redirectTarget = utils.title( 'redirect_target_' ); + const { title: redirectTargetTitle } = await alice.edit( redirectTarget, { text: 'foo' } ); + const { title: redirectSourceTitle } = await alice.edit( redirectSource, { text: `#REDIRECT [[ ${ redirectTarget } ]]` } ); - const { title: redirectTargetTitle } = await alice.edit( redirectTarget, { text: 'foo' } ); await wiki.runAllJobs(); const { body, headers } = await client.get( `/search/title?q=${ redirectSourceTitle }` ); |