Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "factor-in", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Factory functions that return a factory functions that inherit and return objects", | ||
@@ -13,4 +13,3 @@ "main": "index.js", | ||
"devDependencies": { | ||
"babel": "^5.8.23", | ||
"coveralls": "^2.11.3", | ||
"coveralls": "^2.11.4", | ||
"faucet": "0.0.1", | ||
@@ -22,5 +21,5 @@ "istanbul": "^0.3.19", | ||
"scripts": { | ||
"test": "babel-node test | faucet", | ||
"test": "node test | faucet", | ||
"posttest": "standard *.js text/*.js", | ||
"test-cov": "standard *.js text/*.js && istanbul cover test.js" | ||
"test-cov": "standard *.js text/*.js && istanbul cover test" | ||
}, | ||
@@ -27,0 +26,0 @@ "repository": { |
# factor-in | ||
[![NPM version][npm-image]][npm-url] | ||
[![build status][travis-image]][travis-url] | ||
[![Test coverage][coveralls-image]][coveralls-url] | ||
[![js-standard-style][standard-image]][standard-url] | ||
Factory functions that return a factory functions that inherit and custom objects | ||
@@ -41,1 +46,10 @@ | ||
MIT © [Chris Buttery](http://chrisbuttery.com) | ||
[npm-image]: https://img.shields.io/npm/v/factor-in.svg?style=flat-square | ||
[npm-url]: https://npmjs.org/package/factor-in | ||
[travis-image]: https://img.shields.io/travis/chrisbuttery/factor-in.svg?style=flat-square | ||
[travis-url]: https://travis-ci.org/chrisbuttery/factor-in | ||
[standard-image]: https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square | ||
[standard-url]: https://github.com/feross/standard | ||
[coveralls-image]: https://img.shields.io/coveralls/chrisbuttery/factor-in.svg?style=flat-square | ||
[coveralls-url]: https://coveralls.io/r/chrisbuttery/factor-in?branch=master |
@@ -1,8 +0,10 @@ | ||
import { FactorIn as FI, Factory as F } from "../" | ||
import test from 'tape' | ||
var F = require('../') | ||
var FactorIn = F.FactorIn | ||
var Factory = F.Factory | ||
var test = require('tape') | ||
test('Factory should return an empty object when assigned no parameters', t => { | ||
const expected = {} | ||
const factory = F() | ||
const f = factory() | ||
test('Factory should return an empty object when assigned no parameters', function (t) { | ||
var expected = {} | ||
var factory = Factory() | ||
var f = factory() | ||
t.deepEqual(f, expected) | ||
@@ -13,5 +15,5 @@ t.end() | ||
test('Factory should return an object when assigned no parameters', t => { | ||
const expected = {foo: 'foo'} | ||
const factory = F(expected) | ||
test('Factory should return an object when assigned no parameters', function (t) { | ||
var expected = {foo: 'foo'} | ||
var factory = Factory(expected) | ||
t.deepEqual(factory(), expected) | ||
@@ -21,5 +23,5 @@ t.end() | ||
test('FactorIn should return null when assigned no parameters', t => { | ||
const expected = null | ||
const factorIn = FI() | ||
test('FactorIn should return null when assigned no parameters', function (t) { | ||
var expected = null | ||
var factorIn = FactorIn() | ||
t.equal(factorIn, expected) | ||
@@ -29,5 +31,5 @@ t.end() | ||
test('FactorIn should return a null when assigned a function', t => { | ||
const expected = function () {} | ||
const factorIn = FI(expected) | ||
test('FactorIn should return a null when assigned a function', function (t) { | ||
var expected = function () {} | ||
var factorIn = FactorIn(expected) | ||
t.equal(factorIn, null) | ||
@@ -37,5 +39,5 @@ t.end() | ||
test('FactorIn should return an object when assigned parameters', t => { | ||
const expected = 'function' | ||
const factorIn = FI({foo: 'foo'}) | ||
test('FactorIn should return an object when assigned parameters', function (t) { | ||
var expected = 'function' | ||
var factorIn = FactorIn({foo: 'foo'}) | ||
t.equal(typeof(factorIn), expected) | ||
@@ -45,9 +47,9 @@ t.end() | ||
test('FactorIn should consume parameters from a factory', t => { | ||
const expected = {foo: 'foo', bar: 'bar', baz: {id: 1}, qux: 'qux'} | ||
const factorIn = FI({foo: 'foo', bar: 'bar', baz: {id: 1}}) | ||
const factory = F({qux: 'qux'}) | ||
const obj = factorIn(factory) | ||
test('FactorIn should consume parameters from a factory', function (t) { | ||
var expected = {foo: 'foo', bar: 'bar', baz: {id: 1}, qux: 'qux'} | ||
var factorIn = FactorIn({foo: 'foo', bar: 'bar', baz: {id: 1}}) | ||
var factory = Factory({qux: 'qux'}) | ||
var obj = factorIn(factory) | ||
t.deepEqual(obj, expected) | ||
t.end() | ||
}) |
6013
5
78
55