wiki.techinc.nl/tests/api-testing/action/Backlinks.js
Clara Andrew-Wani f07d7ba699 Move tests from api-testing repo into Core
Except for Search & Watchlist, which need fixes in gated extensions first.

Change-Id: I88d24dda4bc047868de3ff9dd4a5753b9c7b0f64
2020-02-05 16:07:54 -08:00

31 lines
923 B
JavaScript

const { action, assert, utils } = require( 'api-testing' );
describe( 'Backlinks', function () {
const randomPage = utils.title( 'Esther' );
const linksToEsther1 = utils.title( 'LinksToEsther1' );
const linksToEsther2 = utils.title( 'LinksToEsther2' );
let bob;
before( async () => {
bob = await action.bob();
const randomPageText = `I'm guessing you came here from ${linksToEsther1} or ${linksToEsther2}.`;
const text = `All I do is link to [[${randomPage}|Page]]`;
await bob.edit( linksToEsther1, { text } );
await bob.edit( linksToEsther2, { text } );
await bob.edit( randomPage, { text: randomPageText } );
} );
describe( 'referrers', () => {
it( 'can be listed', async () => {
const result = await bob.list( 'backlinks', { bltitle: randomPage } );
const links = result.map( ( p )=>( p.title ) );
assert.sameMembers( links, [ linksToEsther1, linksToEsther2 ] );
} );
} );
} );