Skip to content

Commit

Permalink
Merge pull request #2732 from Automattic/update/refactor-domains-purc…
Browse files Browse the repository at this point in the history
…hases-tests

Domains: Purchases: Refactor domains and purchases tests
  • Loading branch information
gziolo committed Jan 25, 2016
2 parents acc4585 + a73a45e commit 8b7f12a
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 12 deletions.
File renamed without changes.
13 changes: 7 additions & 6 deletions client/lib/domains/dns/test/reducer-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* External dependencies
*/
import deepFreeze from 'deep-freeze';
import { expect } from 'chai';
import pick from 'lodash/object/pick';

Expand All @@ -13,11 +14,11 @@ import { reducer } from '../reducer';

describe( 'Domains: DNS reducer', () => {
it( 'should return the same state when no matching record passed in the delete action', () => {
const state = {
const state = deepFreeze( {
[ DOMAIN_NAME ]: {
records: [ RECORD_A ]
}
},
} ),
payload = {
action: {
type: ActionTypes.DNS_DELETE_COMPLETED,
Expand All @@ -32,11 +33,11 @@ describe( 'Domains: DNS reducer', () => {
} );

it( 'should return state without record passed in the delete action', () => {
const state = {
const state = deepFreeze( {
[ DOMAIN_NAME ]: {
records: [ RECORD_TXT ]
}
},
} ),
payload = {
action: {
type: ActionTypes.DNS_DELETE_COMPLETED,
Expand All @@ -52,11 +53,11 @@ describe( 'Domains: DNS reducer', () => {

it( 'should return state without record (having no id) passed in the delete action', () => {
const RECORD_TXT_WITHOUT_ID = pick( RECORD_TXT, [ 'data', 'name', 'type' ] ),
state = {
state = deepFreeze( {
[ DOMAIN_NAME ]: {
records: [ RECORD_TXT_WITHOUT_ID ]
}
},
} ),
payload = {
action: {
type: ActionTypes.DNS_DELETE_COMPLETED,
Expand Down
9 changes: 5 additions & 4 deletions client/lib/domains/email-forwarding/test/reducer-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
/**
* External dependencies
*/
import deepFreeze from 'deep-freeze';
import { expect } from 'chai';

/**
Expand All @@ -12,11 +13,11 @@ import { reducer } from './../reducer';

describe( 'Domains: Email Forwarding Reducer', () => {
it( 'should return the same state when no matching record passed in the delete complete action', () => {
const state = {
const state = deepFreeze( {
[ DOMAIN_NAME ]: {
list: EMAIL_FORWARDS
}
},
} ),
payload = {
action: {
type: ActionTypes.EMAIL_FORWARDING_DELETE_COMPLETED,
Expand All @@ -35,11 +36,11 @@ describe( 'Domains: Email Forwarding Reducer', () => {
} );

it( 'should return state without record passed in the delete completed action', () => {
const state = {
const state = deepFreeze( {
[ DOMAIN_NAME ]: {
list: EMAIL_FORWARDS
}
},
} ),
payload = {
action: {
type: ActionTypes.EMAIL_FORWARDING_DELETE_COMPLETED,
Expand Down
2 changes: 1 addition & 1 deletion client/lib/purchases/stored-cards/test/assembler-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { expect } from 'chai';
* Internal dependencies
*/
import { createStoredCardsArray } from '../assembler.js';
import { STORED_CARDS_FROM_API, STORED_CARDS } from './constants';
import { STORED_CARDS_FROM_API, STORED_CARDS } from './data';

describe( 'Stored Cards assembler', () => {
it( 'should be a function', () => {
Expand Down
2 changes: 1 addition & 1 deletion client/lib/purchases/stored-cards/test/store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import rest from 'lodash/array/rest';
*/
import { action as ActionTypes } from 'lib/upgrades/constants';
import Dispatcher from 'dispatcher';
import { STORED_CARDS_FROM_API, STORED_CARDS } from './constants';
import { STORED_CARDS_FROM_API, STORED_CARDS } from './data';
import StoredCardsStore from './../store';

describe( 'Stored Cards Store', () => {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@
"blanket": "1.1.6",
"chai": "2.0.0",
"chai-immutable": "^1.4.0",
"deep-freeze": "0.0.1",
"enzyme": "1.1.0",
"esformatter": "0.7.3",
"esformatter-braces": "1.2.1",
Expand Down

0 comments on commit 8b7f12a

Please sign in to comment.