mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Popups
synced 2024-11-15 11:46:55 +00:00
807100bcca
Enforce it with eslint. Ignore: * Comment lines with eslint disable directives * QUnit test lines as they contain long subjects (QUnit.* (only, test, module, skip, etc) * Strings, since long strings are used extensively in tests * Ignore template literals for similar reasons * Regex literals as they may be too long, but can't be easily split in several lines * Long urls See bug for more general proposal for eslint-wikimedia-config. Bug: T185295 Change-Id: I3aacaf46e61a4d96547c513073e179ef997deb09
42 lines
1.3 KiB
JavaScript
42 lines
1.3 KiB
JavaScript
import createGateway from '../../../src/gateway';
|
|
import * as RestModule from '../../../src/gateway/rest';
|
|
import * as MediawikiModule from '../../../src/gateway/mediawiki';
|
|
|
|
QUnit.module( 'gateway/index.js', {
|
|
beforeEach: function () {
|
|
mediaWiki.Api = function () {};
|
|
|
|
this.createMediaWikiApiGateway =
|
|
this.sandbox.stub( MediawikiModule, 'default' );
|
|
this.createRESTBaseGateway = this.sandbox.stub( RestModule, 'default' );
|
|
|
|
this.config = new Map(); /* global Map */
|
|
}
|
|
} );
|
|
|
|
QUnit.test( 'it uses mediawiki plain text gateway with wgPopupsGateway == "mwApiPlain"', function ( assert ) {
|
|
this.config.set( 'wgPopupsGateway', 'mwApiPlain' );
|
|
|
|
createGateway( this.config );
|
|
|
|
assert.ok( this.createMediaWikiApiGateway.called,
|
|
'MW plain text gateway called' );
|
|
} );
|
|
|
|
QUnit.test( 'it uses rest plain text gateway with wgPopupsGateway == "restbasePlain"', function ( assert ) {
|
|
this.config.set( 'wgPopupsGateway', 'restbasePlain' );
|
|
|
|
createGateway( this.config );
|
|
|
|
assert.ok( this.createRESTBaseGateway.called,
|
|
'REST plain text gateway called' );
|
|
} );
|
|
|
|
QUnit.test( 'it uses rest HTML gateway with wgPopupsGateway == "restbaseHTML"', function ( assert ) {
|
|
this.config.set( 'wgPopupsGateway', 'restbaseHTML' );
|
|
|
|
createGateway( this.config );
|
|
|
|
assert.ok( this.createRESTBaseGateway.called, 'REST HTML gateway called' );
|
|
} );
|