wiki.techinc.nl/tests/api-testing/action/PrefixSearch.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

26 lines
826 B
JavaScript

const { action, assert, utils } = require( 'api-testing' );
describe( 'Prefix Search', function () {
const prefix = `R${utils.title( utils.uniq() )}`;
const firstPage = `${prefix}_first`;
const secondPage = `${prefix}_second`;
const thirdPage = `${prefix}_third`;
let alice;
before( async () => {
alice = await action.alice();
const text = 'Random Text';
await alice.edit( firstPage, { text } );
await alice.edit( secondPage, { text } );
await alice.edit( thirdPage, { text } );
} );
it( 'should search for pages with the `${prefix}` prefix', async () => {
const result = await alice.list( 'prefixsearch', { pssearch: `${prefix}`, pslimit: 100 } );
const pageTitles = result.map( ( p )=>utils.dbkey( p.title ) );
assert.sameMembers( pageTitles, [ firstPage, secondPage, thirdPage ] );
} );
} );