From 7a14fbda859e994769d1fde9082f0be1aa7494a1 Mon Sep 17 00:00:00 2001 From: Grzegorz Ziolkowski Date: Wed, 9 Mar 2016 09:50:48 +0100 Subject: [PATCH] Purchases: Add unit tests to single test runner --- client/lib/purchases/Makefile | 12 ------------ client/lib/purchases/stored-cards/Makefile | 12 ------------ .../test/{assembler-test.js => assembler.js} | 2 +- .../stored-cards/test/{store-test.js => store.js} | 2 +- .../test/{assembler-test.js => assembler.js} | 2 +- .../lib/purchases/test/{index-test.js => index.js} | 6 +++--- .../lib/purchases/test/{store-test.js => store.js} | 2 +- client/test/config.json | 6 ++++++ 8 files changed, 13 insertions(+), 31 deletions(-) delete mode 100644 client/lib/purchases/Makefile delete mode 100644 client/lib/purchases/stored-cards/Makefile rename client/lib/purchases/stored-cards/test/{assembler-test.js => assembler.js} (94%) rename client/lib/purchases/stored-cards/test/{store-test.js => store.js} (98%) rename client/lib/purchases/test/{assembler-test.js => assembler.js} (96%) rename client/lib/purchases/test/{index-test.js => index.js} (93%) rename client/lib/purchases/test/{store-test.js => store.js} (99%) diff --git a/client/lib/purchases/Makefile b/client/lib/purchases/Makefile deleted file mode 100644 index 144f51e580df6..0000000000000 --- a/client/lib/purchases/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -NODE_BIN := $(shell npm bin) -MOCHA ?= $(NODE_BIN)/mocha -BASE_DIR := $(NODE_BIN)/../.. -NODE_PATH := test:$(BASE_DIR)/client -COMPILERS ?= js:babel/register -REPORTER ?= spec -UI ?= bdd - -test: - @NODE_ENV=test NODE_PATH=$(NODE_PATH) $(MOCHA) --compilers $(COMPILERS) --reporter $(REPORTER) --ui $(UI) - -.PHONY: test diff --git a/client/lib/purchases/stored-cards/Makefile b/client/lib/purchases/stored-cards/Makefile deleted file mode 100644 index 144f51e580df6..0000000000000 --- a/client/lib/purchases/stored-cards/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -NODE_BIN := $(shell npm bin) -MOCHA ?= $(NODE_BIN)/mocha -BASE_DIR := $(NODE_BIN)/../.. -NODE_PATH := test:$(BASE_DIR)/client -COMPILERS ?= js:babel/register -REPORTER ?= spec -UI ?= bdd - -test: - @NODE_ENV=test NODE_PATH=$(NODE_PATH) $(MOCHA) --compilers $(COMPILERS) --reporter $(REPORTER) --ui $(UI) - -.PHONY: test diff --git a/client/lib/purchases/stored-cards/test/assembler-test.js b/client/lib/purchases/stored-cards/test/assembler.js similarity index 94% rename from client/lib/purchases/stored-cards/test/assembler-test.js rename to client/lib/purchases/stored-cards/test/assembler.js index 5e8ec753fa158..0b3e63c661533 100644 --- a/client/lib/purchases/stored-cards/test/assembler-test.js +++ b/client/lib/purchases/stored-cards/test/assembler.js @@ -9,7 +9,7 @@ import { expect } from 'chai'; import { createStoredCardsArray } from '../assembler.js'; import { STORED_CARDS_FROM_API, STORED_CARDS } from './data'; -describe( 'Stored Cards assembler', () => { +describe( 'assembler', () => { it( 'should be a function', () => { expect( createStoredCardsArray ).to.be.an( 'function' ); } ); diff --git a/client/lib/purchases/stored-cards/test/store-test.js b/client/lib/purchases/stored-cards/test/store.js similarity index 98% rename from client/lib/purchases/stored-cards/test/store-test.js rename to client/lib/purchases/stored-cards/test/store.js index 8ea67f9c5c785..916bbe7b009eb 100644 --- a/client/lib/purchases/stored-cards/test/store-test.js +++ b/client/lib/purchases/stored-cards/test/store.js @@ -14,7 +14,7 @@ import Dispatcher from 'dispatcher'; import { STORED_CARDS_FROM_API, STORED_CARDS } from './data'; import StoredCardsStore from './../store'; -describe( 'Stored Cards Store', () => { +describe( 'store', () => { it( 'should be an object', () => { expect( StoredCardsStore ).to.be.an( 'object' ); } ); diff --git a/client/lib/purchases/test/assembler-test.js b/client/lib/purchases/test/assembler.js similarity index 96% rename from client/lib/purchases/test/assembler-test.js rename to client/lib/purchases/test/assembler.js index 82855abb1a350..179c468d5e8fa 100644 --- a/client/lib/purchases/test/assembler-test.js +++ b/client/lib/purchases/test/assembler.js @@ -9,7 +9,7 @@ import moment from 'moment'; */ import { createPurchasesArray } from '../assembler'; -describe( 'Purchases assembler', () => { +describe( 'assembler', () => { it( 'should be a function', () => { expect( createPurchasesArray ).to.be.an( 'function' ); } ); diff --git a/client/lib/purchases/test/index-test.js b/client/lib/purchases/test/index.js similarity index 93% rename from client/lib/purchases/test/index-test.js rename to client/lib/purchases/test/index.js index da3e5cbcdead4..356d8006d344d 100644 --- a/client/lib/purchases/test/index-test.js +++ b/client/lib/purchases/test/index.js @@ -13,11 +13,11 @@ import { DOMAIN_MAPPING_PURCHASE_EXPIRED, SITE_REDIRECT_PURCHASE, SITE_REDIRECT_PURCHASE_EXPIRED -} from 'data'; +} from './data'; import { isRemovable } from '../index'; -describe( 'Purchases Utils', () => { - describe( 'isRemovable', () => { +describe( 'index', () => { + describe( '#isRemovable', () => { it( 'should not be removable when domain registration purchase is not expired', () => { expect( isRemovable( DOMAIN_PURCHASE ) ).to.be.false; } ); diff --git a/client/lib/purchases/test/store-test.js b/client/lib/purchases/test/store.js similarity index 99% rename from client/lib/purchases/test/store-test.js rename to client/lib/purchases/test/store.js index 50d8141dd69d7..71e9dc8b79f15 100644 --- a/client/lib/purchases/test/store-test.js +++ b/client/lib/purchases/test/store.js @@ -11,7 +11,7 @@ import defer from 'lodash/defer'; import { action as actionTypes } from 'lib/upgrades/constants'; import PurchasesStore from '../store'; -describe( 'Purchases Store', () => { +describe( 'store', () => { const userId = 1337, siteId = 2701; diff --git a/client/test/config.json b/client/test/config.json index 134cfe0813417..4e601f2e56ce8 100644 --- a/client/test/config.json +++ b/client/test/config.json @@ -27,6 +27,12 @@ "posts": { "test": [ "actions", "post-edit-store", "post-list-store", "utils" ] }, + "purchases": { + "stored-cards": { + "test": [ "assembler", "store" ] + }, + "test": [ "assembler", "index", "store" ] + }, "store": { "test": [ "index-test" ] }