Skip to content

Commit

Permalink
Test: Move simpler tests from lib/* to single test runner
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Mar 11, 2016
1 parent 786a675 commit 1098f50
Show file tree
Hide file tree
Showing 22 changed files with 49 additions and 122 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { actions as ActionTypes } from '../constants'

const debug = require( 'debug' )( 'calypso:comment-store:test' ); //eslint-disable-line no-unused-vars

describe( 'auth-request-store', () => {
describe( 'index', () => {
beforeEach( function() {
Dispatcher.handleViewAction( { type: ActionTypes.AUTH_CODE_REQUEST_RESET } );
} );
Expand All @@ -16,7 +16,7 @@ describe( 'auth-request-store', () => {
errorLevel: false,
errorMessage: false
} )
} )
} );

it( 'is in progress when requesting code', () => {
Dispatcher.handleViewAction( { type: ActionTypes.AUTH_CODE_REQUEST } );
Expand Down
14 changes: 0 additions & 14 deletions client/lib/comment-like-store/Makefile

This file was deleted.

14 changes: 0 additions & 14 deletions client/lib/comment-store/Makefile

This file was deleted.

10 changes: 0 additions & 10 deletions client/lib/create-selector/Makefile

This file was deleted.

7 changes: 2 additions & 5 deletions client/lib/create-selector/test/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
/**
* External dependencies
*/
import Chai, { expect } from 'chai';
import { expect } from 'chai';
import filter from 'lodash/filter';
import sinon from 'sinon';
import sinonChai from 'sinon-chai';

/**
* Internal dependencies
*/
import createSelector from '../';

describe( '#createSelector', () => {
describe( 'index', () => {
let selector, getSitePosts;

before( () => {
Chai.use( sinonChai );

selector = sinon.spy( ( state, siteId ) => {
return filter( state.posts, { site_ID: siteId } );
} );
Expand Down
9 changes: 0 additions & 9 deletions client/lib/deterministic-stringify/Makefile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var deterministicStringify = require( 'lib/deterministic-stringify' );

var assert = require( 'assert' );

describe( 'DeterministicStringify', function() {
describe( 'index', function() {
it( 'should handle boolean', function() {
assert.equal( 'true', deterministicStringify( true ) );
assert.equal( 'false', deterministicStringify( false ) );
Expand Down
7 changes: 0 additions & 7 deletions client/lib/form-state/Makefile

This file was deleted.

4 changes: 2 additions & 2 deletions client/lib/form-state/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ function testController( options ) {
return formState.Controller( assign( defaults, options ) );
}

describe( 'form', function() {
describe( 'Controller', function() {
describe( 'index', function() {
describe( '#Controller', function() {
describe( '#getInitialState', function() {
it( 'returns disabled fields', function() {
var controller = testController( { fieldNames: [ 'firstName' ] } ),
Expand Down
13 changes: 0 additions & 13 deletions client/lib/i18n-utils/Makefile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { expect } from 'chai';
*/
import { removeLocaleFromPath, getLanguage, getLocaleFromPath } from 'lib/i18n-utils';

describe( 'i18n-utils', function() {
describe( 'removeLocaleFromPath', function() {
describe( 'utils', function() {
describe( '#removeLocaleFromPath', function() {
it( 'should remove the :lang part of the URL', function() {
assert.equal( removeLocaleFromPath( '/start/fr' ), '/start' );
assert.equal( removeLocaleFromPath( '/start/flow/fr' ), '/start/flow' );
Expand Down Expand Up @@ -39,7 +39,7 @@ describe( 'i18n-utils', function() {
} );
} );

describe( 'getLocaleFromPath', function() {
describe( '#getLocaleFromPath', function() {
it( 'should return undefined when no locale at end of path', function() {
assert.equal( getLocaleFromPath( '/start' ), undefined );
} );
Expand All @@ -50,7 +50,7 @@ describe( 'i18n-utils', function() {
} );
} );

describe( 'getLanguage', function() {
describe( '#getLanguage', function() {
it( 'should return a language', function() {
expect( getLanguage( 'ja' ).langSlug ).to.equal( 'ja' );
} );
Expand Down
12 changes: 0 additions & 12 deletions client/lib/mixins/pageable/Makefile

This file was deleted.

File renamed without changes.
7 changes: 0 additions & 7 deletions client/lib/mixins/searchable/Makefile

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ var makeCollection = function() {
};


describe( 'Searchable', function() {

describe( 'index', function() {
describe( 'searchNodes as array', function() {
it( 'should find node', function() {
var Collection = makeCollection(),
Expand Down
7 changes: 0 additions & 7 deletions client/lib/mixins/url-search/Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion client/lib/mixins/url-search/test/build-url.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var expect = require( 'chai' ).expect;
*/
var buildUrl = require( '../build-url' );

describe( '#buildUrl()', function() {
describe( 'build-url', function() {
it( 'should accept a path without existing query parameters', function() {
var url = buildUrl( '/path', 'terms' );

Expand Down
10 changes: 0 additions & 10 deletions client/reader/route/Makefile

This file was deleted.

2 changes: 1 addition & 1 deletion client/reader/route/test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ var expect = require( 'chai' ).expect;
*/
var route = require( '../' );

describe( 'reader/route', function() {
describe( 'index', function() {
describe( 'getStreamUrlFromPost', function() {
it( 'should return url for post from feed', function() {
expect( route.getStreamUrlFromPost( { feed_ID: 1234 } ) ).to.equal( '/read/feeds/1234' );
Expand Down
34 changes: 34 additions & 0 deletions client/tests.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
}
},
"lib": {
"auth-code-request-store": {
"test": [ "index" ]
},
"cart": {
"store": {
"test": [ "cart-synchronizer" ]
Expand All @@ -18,6 +21,15 @@
"credit-card-details" : {
"test": [ "index" ]
},
"comment-like-store": {
"test": [ "comment-like-store" ]
},
"create-selector": {
"test": [ "index" ]
},
"deterministic-stringify": {
"test": [ "index" ]
},
"domains": {
"dns": {
"test": [ "index", "reducer" ]
Expand All @@ -33,6 +45,23 @@
"test": [ "assembler", "store" ]
}
},
"form-state": {
"test": [ "index" ]
},
"i18n-utils" : {
"test": [ "utils" ]
},
"mixins" : {
"pageable": {
"test": [ "index" ]
},
"searchable": {
"test": [ "index" ]
},
"url-search": {
"test": [ "build-url" ]
}
},
"network-connection" : {
"test": [ "index" ]
},
Expand Down Expand Up @@ -97,6 +126,11 @@
}
}
},
"reader": {
"route": {
"test": [ "index" ]
}
},
"state": {
"application": {
"test": [ "actions", "reducer" ]
Expand Down
2 changes: 1 addition & 1 deletion test/test/helpers/use-filesystem-mocks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ function findQuickMocks( dirpath ) {
} );
}

export default function( dirpath ) {
export default function( dirpath = __dirname ) {
useMockery( findQuickMocks.bind( null, dirpath ), null );
}

0 comments on commit 1098f50

Please sign in to comment.