mediawiki.user.test: Fix getGroups() regression
authorTimo Tijhof <ttijhof@wikimedia.org>
Sun, 2 Sep 2012 19:43:08 +0000 (21:43 +0200)
committerTimo Tijhof <ttijhof@wikimedia.org>
Sun, 2 Sep 2012 19:43:08 +0000 (21:43 +0200)
* Test depended on sort order, fixing by looking up index
  instead.

  Order is not documented and should not be depended on,
  therefore updating the test instead of changing the output.

* Follows-up 1e8992ca7489e620d157d9a50d9aa5e611b84887

Change-Id: Id72b0550e5c0e1ae5454005f9245d1d542fc2e46

tests/qunit/suites/resources/mediawiki/mediawiki.user.test.js

index c823baf..16c97df 100644 (file)
@@ -37,7 +37,7 @@ QUnit.asyncTest( 'getGroups', 3, function ( assert ) {
        mw.user.getGroups( function ( groups ) {
                // First group should always be '*'
                assert.equal( $.type( groups ), 'array', 'Callback gets an array' );
-               assert.equal( groups[0], '*', '"*"" is the first group' );
+               assert.notStrictEqual( $.inArray( '*', groups ), -1, '"*"" is in the list' );
                // Sort needed because of different methods if creating the arrays,
                // only the content matters.
                assert.deepEqual( groups.sort(), mw.config.get( 'wgUserGroups' ).sort(), 'Array contains all groups, just like wgUserGroups' );