Debian Codegraph @

tests/api-testing/action/DiffCompare.js

raw symbols SCIP
1 'use strict';
2
3 const { action, assert, utils } = require( 'api-testing' );
4
5 describe( 'Diff Compare with Variables', () => {
6 let wikiuser;
7 const title = utils.title( 'DiffCompare' );
8 const variables = {};
9
10 before( async () => {
11 wikiuser = await action.alice();
12 } );
13
14 it( 'should edit a page', async () => {
15 const editPage = await wikiuser.edit( title, { text: 'Counting: \n* One' } );
16
17 variables.revision1 = editPage.newrevid;
18 } );
19
20 it( 'should edit a page, revision 2', async () => {
21 await wikiuser.edit( title, { text: 'Counting: \n* One \n* Two' } );
22 } );
23
24 it( 'should edit a page, revision 3', async () => {
25 const editPage = await wikiuser.edit( title, { text: 'Counting: \n* One \n* Two \n* Three' } );
26
27 variables.revision3 = editPage.newrevid;
28 } );
29
30 it( 'should edit a page, revision 4', async () => {
31 const editPage = await wikiuser.edit( title, { text: 'Counting: \n* One \n* Two' } );
32
33 variables.revision4 = editPage.newrevid;
34 } );
35
36 it( 'should compare revisions 1 and 4', async () => {
37 const compareRevisions = await wikiuser.action( 'compare', { fromrev: variables.revision1, torev: variables.revision4 } );
38
39 assert.match( compareRevisions.compare[ '*' ], /<td class=.diff-addedline.*>.*\* Two/ );
40 } );
41
42 it( 'should compare revisions 3 and 4', async () => {
43 const compareRevisions = await wikiuser.action( 'compare', { fromrev: variables.revision3, torev: variables.revision4 } );
44
45 assert.match( compareRevisions.compare[ '*' ], /<td class=.diff-deletedline.*>.*\* Three/ );
46 } );
47 } );