wiki.techinc.nl/tests/api-testing/action/PrefixSearch.js
Ed Sanders d94f90e088 eslint: Code style fixes for upcoming config change
Change-Id: Ief44c0bb26c5a1c1773cab5dba51d5e856612bf7
2020-05-14 22:19:55 +01:00

26 lines
828 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 ] );
} );
} );