| 1 |
'use strict'; |
| 2 |
|
| 3 |
const { action, assert, utils } = require( 'api-testing' ); |
| 4 |
|
| 5 |
describe( 'Reparse of dependent pages', () => { |
| 6 |
const title = utils.title( 'Reparse_' ); |
| 7 |
const template = utils.title( 'Template' ); |
| 8 |
const link = utils.title( 'Link' ); |
| 9 |
|
| 10 |
let alice; |
| 11 |
|
| 12 |
before( async () => { |
| 13 |
alice = await action.alice(); |
| 14 |
} ); |
| 15 |
|
| 16 |
it( 'should create a page with missing template and link', async () => { |
| 17 |
await alice.edit( title, { text: `{{${ template }}} [[${ link }]]`, createonly: true } ); |
| 18 |
|
| 19 |
const html = await alice.getHtml( title ); |
| 20 |
|
| 21 |
assert.match( html, new RegExp( `title=Template:${ template }&action=edit&redlink=1` ) ); |
| 22 |
assert.match( html, new RegExp( `title=${ link }&action=edit&redlink=1` ) ); |
| 23 |
} ); |
| 24 |
|
| 25 |
it( 'should create missing template and link', async () => { |
| 26 |
await alice.edit( `Template:${ template }`, { text: 'Howdy', createonly: true } ); |
| 27 |
await alice.edit( link, { text: 'Test link', createonly: true } ); |
| 28 |
} ); |
| 29 |
|
| 30 |
|
| 31 |
it.skip( 'should get page with updated template and link', async () => { |
| 32 |
const { parse } = await alice.action( 'parse', { page: title } ); |
| 33 |
|
| 34 |
assert.notInclude( parse.text[ '*' ], 'redlink=1' ); |
| 35 |
assert.exists( parse.links[ 0 ].exists ); |
| 36 |
assert.exists( parse.templates[ 0 ].exists ); |
| 37 |
} ); |
| 38 |
} ); |