mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/Math
synced 2024-11-15 03:34:10 +00:00
951dec1fab
Implement a rest API endpoint that displays the popup that is currently only shown on a special page. Code was revived from Idd22057a88312bf1a1cb5546d0a6edca5678d80d Bug: T288076 Bug: T233099 Change-Id: I65fcbf25ac5818f6c649daf494c719921247e8f5
22 lines
788 B
JavaScript
22 lines
788 B
JavaScript
'use strict';
|
|
|
|
const { assert, REST } = require( 'api-testing' );
|
|
|
|
describe( 'Math popup endpoint test', () => {
|
|
const client = new REST( 'rest.php/math/v0' );
|
|
|
|
it( 'should get a 400 response for bad value of hash param', async () => {
|
|
const { status, body } = await client.get( '/popup/html/thebadvalue' );
|
|
assert.strictEqual( status, 400 );
|
|
assert.strictEqual( body.httpReason, 'Bad Request' );
|
|
assert.include( body.messageTranslations.en, 'thebadvalue' );
|
|
} );
|
|
|
|
it( 'should get a 400 response for a malformed item ID starting with Q', async () => {
|
|
const { status, body } = await client.get( '/popup/html/Q1' );
|
|
assert.strictEqual( status, 400 );
|
|
assert.strictEqual( body.httpReason, 'Bad Request' );
|
|
assert.include( body.messageTranslations.en, 'Q1' );
|
|
} );
|
|
} );
|