var chromatic = require('../');
var test = require('tape');
var isFunction = require('lodash.isfunction');

test('exports a function', function(t) {
  t.plan(1);
  t.ok(isFunction(chromatic));
});

test('6L: 2R, 2G, 2B', function(t) {
  t.plan(1);
  t.equal(chromatic({
    sockets: 6,
    red: 2,
    green: 2,
    blue: 2
  }), 0.12360541218759537);
});

test('6L: 180 str, 5R, 1G', function(t) {
  t.plan(1);
  t.equal(chromatic({
    sockets: 6,
    red: 5,
    green: 1,
    strength: 180
  }), 0.23161598136624462);
});

test('6L: 180 str, 6B', function(t) {
  t.plan(1);
  t.equal(chromatic({
    sockets: 6,
    blue: 6,
    strength: 180
  }), 2.857774383586962e-7);
});

test('6L: 212 dex, 5G, 1B', function(t) {
  t.plan(1);
  t.equal(chromatic({
    sockets: 6,
    green: 5,
    blue: 1,
    dexterity: 212
  }), 0.2375764986368402);
});

test('throws on invalid sockets', function(t) {
  t.plan(3);
  t.throws(chromatic.bind(null, {}), new RegExp(/expected: 0 < opts.sockets < 7/));
  t.throws(chromatic.bind(null, {sockets: 0}), new RegExp(/expected: 0 < opts.sockets < 7/));
  t.throws(chromatic.bind(null, {sockets: 7}), new RegExp(/expected: 0 < opts.sockets < 7/));
});

test('throws on invalid desired sockets', function(t) {
  var FIXTURES = [
    {red: -1},
    {green: -2},
    {blue: -3},
    {},
    {red: 7},
    {green: 8},
    {blue: 9},
    {red: 3, green: 2, blue: 2}
  ];

  t.plan(FIXTURES.length);

  FIXTURES.forEach(function(f) {
    f.sockets = 6;
    t.throws(chromatic.bind(null, f), new RegExp(/invalid number of desired sockets/));
  });
});

@@ -910,44 +910,25 @@
 3);%0A
+%0A
   
-t.throws(chromatic.bind(null, %7B%7D),
+var expected =
  new
@@ -960,34 +960,34 @@
 ts.sockets %3C 7/)
-)
 ;
+%0A
 %0A  t.throws(chro
@@ -1008,66 +1008,78 @@
 l, %7B
-sockets: 0%7D), new RegExp(/expected: 0 %3C opts.sockets %3C 7/)
+%7D), expected);%0A  t.throws(chromatic.bind(null, %7Bsockets: 0%7D), expected
 );%0A 
@@ -1128,52 +1128,16 @@
 %7D), 
-new RegExp(/expected: 0 %3C opts.sockets %3C 7/)
+expected
 );%0A%7D
@@ -1352,16 +1352,84 @@
  2%7D%0A  %5D;
+%0A  var invalidMsg = new RegExp(/invalid number of desired sockets/);
 %0A%0A  t.pl
@@ -1544,55 +1544,18 @@
 f), 
-new RegExp(/invalid number of desired sockets/)
+invalidMsg
 );%0A 

Enforce 80-character line limit