wiki.techinc.nl/tests/api-testing/action/Preferences.js
Clara Andrew-Wani f07d7ba699 Move tests from api-testing repo into Core
Except for Search & Watchlist, which need fixes in gated extensions first.

Change-Id: I88d24dda4bc047868de3ff9dd4a5753b9c7b0f64
2020-02-05 16:07:54 -08:00

27 lines
820 B
JavaScript

const { action, assert } = require( 'api-testing' );
describe( "Changing a user's preferences", function () {
let alice;
before( async () => {
alice = await action.alice();
} );
it( 'should get users default date settings', async () => {
const result = await alice.meta( 'userinfo', { uiprop: 'options' } );
assert.equal( result.options.date, 'default' );
} );
it( 'should change date preference from default to dmy', async () => {
const token = await alice.token();
const result = await alice.action( 'options', { change: 'date=dmy', token }, 'POST' );
assert.equal( result.options, 'success' );
} );
it( 'should get users updated date preference', async () => {
const result = await alice.meta( 'userinfo', { uiprop: 'options' } );
assert.equal( result.options.date, 'dmy' );
} );
} );