Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Domains: Purchases: Refactor domains and purchases tests #2732

Merged
merged 3 commits into from
Jan 25, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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