| 1 | 'use strict'; |
| 2 | |
| 3 | const { assert, REST } = require( 'api-testing' ); |
| 4 | |
| 5 | describe( 'Math popup endpoint test', () => { |
| 6 | const client = new REST( 'rest.php/math/v0' ); |
| 7 | |
| 8 | it( 'should get a 400 response for bad value of hash param', async () => { |
| 9 | const { status, body } = await client.get( '/popup/html/thebadvalue' ); |
| 10 | assert.strictEqual( status, 400 ); |
| 11 | assert.strictEqual( body.httpReason, 'Bad Request' ); |
| 12 | assert.include( body.messageTranslations.en, 'thebadvalue' ); |
| 13 | } ); |
| 14 | |
| 15 | it( 'should get a 400 response for a malformed item ID starting with Q', async () => { |
| 16 | const { status, body } = await client.get( '/popup/html/Q1' ); |
| 17 | assert.strictEqual( status, 400 ); |
| 18 | assert.strictEqual( body.httpReason, 'Bad Request' ); |
| 19 | assert.include( body.messageTranslations.en, 'Q1' ); |
| 20 | } ); |
| 21 | } ); |