Debian Codegraph @

tests/api-testing/action/ListUsers.js

raw symbols SCIP
1 'use strict';
2
3 const { action, assert, utils } = require( 'api-testing' );
4
5 describe( 'Listing Users', () => {
6 let prefix;
7
8 // users
9 const user1 = action.getAnon();
10 const user2 = action.getAnon();
11 const user3 = action.getAnon();
12
13 before( async () => {
14 prefix = await utils.title();
15 prefix = prefix.slice( 0, 7 );
16
17 // NOTE: Because of T199393, the accounts have to be created sequentially.
18 // Doing so in parallel triggers a race condition that often results in a DBQueryError.
19 await user1.account( `${ prefix }1` );
20 await user2.account( `${ prefix }2` );
21 await user3.account( `${ prefix }3` );
22 } );
23
24 it( 'should get a list of registered users that begin with a given prefix', async () => {
25 const result = await user1.list( 'allusers', { auprefix: prefix } );
26
27 assert.sameDeepMembers( result, [
28 { name: user1.username, userid: user1.userid },
29 { name: user2.username, userid: user2.userid },
30 { name: user3.username, userid: user3.userid }
31 ] );
32 assert.lengthOf( result, 3 );
33 } );
34 } );