Skip to content

Commit

Permalink
remove should
Browse files Browse the repository at this point in the history
  • Loading branch information
jonschlinkert committed Jun 15, 2016
1 parent f05b371 commit 7484daa
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 35 deletions.
1 change: 0 additions & 1 deletion test/app.layout.js
@@ -1,7 +1,6 @@
'use strict';

require('mocha');
require('should');
var assert = require('assert');
var assemble = require('..');
var app;
Expand Down
1 change: 0 additions & 1 deletion test/app.layouts.js
@@ -1,7 +1,6 @@
'use strict';

require('mocha');
require('should');
var assert = require('assert');
var assemble = require('..');
var app;
Expand Down
1 change: 0 additions & 1 deletion test/app.page.js
@@ -1,7 +1,6 @@
'use strict';

require('mocha');
require('should');
var assert = require('assert');
var assemble = require('..');
var app;
Expand Down
1 change: 0 additions & 1 deletion test/app.pages.js
@@ -1,7 +1,6 @@
'use strict';

require('mocha');
require('should');
var assert = require('assert');
var assemble = require('..');
var app;
Expand Down
1 change: 0 additions & 1 deletion test/app.partial.js
@@ -1,7 +1,6 @@
'use strict';

require('mocha');
require('should');
var assert = require('assert');
var assemble = require('..');
var app;
Expand Down
1 change: 0 additions & 1 deletion test/app.partials.js
@@ -1,7 +1,6 @@
'use strict';

require('mocha');
require('should');
var assert = require('assert');
var assemble = require('..');
var app;
Expand Down
61 changes: 32 additions & 29 deletions test/app.store.js
@@ -1,7 +1,6 @@
'use strict';

require('mocha');
require('should');
var fs = require('fs');
var path = require('path');
var assert = require('assert');
Expand All @@ -12,7 +11,7 @@ var app;
describe('store', function() {
describe('methods', function() {
beforeEach(function() {
app = new App({cli: true});
app = new App();
app.use(store());
app.store.create('app-data-tests');
});
Expand All @@ -25,42 +24,42 @@ describe('store', function() {

it('should `.set()` a value on the store', function() {
app.store.set('one', 'two');
app.store.data.one.should.equal('two');
assert.equal(app.store.data.one, 'two');
});

it('should `.set()` an object', function() {
app.store.set({four: 'five', six: 'seven'});
app.store.data.four.should.equal('five');
app.store.data.six.should.equal('seven');
assert.equal(app.store.data.four, 'five');
assert.equal(app.store.data.six, 'seven');
});

it('should `.set()` a nested value', function() {
app.store.set('a.b.c.d', {e: 'f'});
app.store.data.a.b.c.d.e.should.equal('f');
assert.equal(app.store.data.a.b.c.d.e, 'f');
});

it('should `.union()` a value on the store', function() {
app.store.union('one', 'two');
app.store.data.one.should.eql(['two']);
assert.deepEqual(app.store.data.one, ['two']);
});

it('should not union duplicate values', function() {
app.store.union('one', 'two');
app.store.data.one.should.eql(['two']);
assert.deepEqual(app.store.data.one, ['two']);

app.store.union('one', ['two']);
app.store.data.one.should.eql(['two']);
assert.deepEqual(app.store.data.one, ['two']);
});

it('should concat an existing array:', function() {
app.store.union('one', 'a');
app.store.data.one.should.eql(['a']);
assert.deepEqual(app.store.data.one, ['a']);

app.store.union('one', ['b']);
app.store.data.one.should.eql(['a', 'b']);
assert.deepEqual(app.store.data.one, ['a', 'b']);

app.store.union('one', ['c', 'd']);
app.store.data.one.should.eql(['a', 'b', 'c', 'd']);
assert.deepEqual(app.store.data.one, ['a', 'b', 'c', 'd']);
});

it('should return true if a key `.has()` on the store', function() {
Expand Down Expand Up @@ -121,32 +120,32 @@ describe('store', function() {

it('should `.get()` a stored value', function() {
app.store.set('three', 'four');
app.store.get('three').should.equal('four');
assert.equal(app.store.get('three'), 'four');
});

it('should `.get()` a nested value', function() {
app.store.set({a: {b: {c: 'd'}}});
app.store.get('a.b.c').should.equal('d');
assert.equal(app.store.get('a.b.c'), 'd');
});

it('should `.del()` a stored value', function() {
app.store.set('a', 'b');
app.store.set('c', 'd');
app.store.data.should.have.property('a');
app.store.data.should.have.property('c');
assert(app.store.data.hasOwnProperty('a'));
assert(app.store.data.hasOwnProperty('c'));

app.store.del('a');
app.store.del('c');
app.store.data.should.not.have.property('a');
app.store.data.should.not.have.property('c');
assert(!app.store.data.hasOwnProperty('a'));
assert(!app.store.data.hasOwnProperty('c'));
});

it('should `.del()` multiple stored values', function() {
app.store.set('a', 'b');
app.store.set('c', 'd');
app.store.set('e', 'f');
app.store.del(['a', 'c', 'e']);
app.store.data.should.eql({});
assert.deepEqual(app.store.data, {});
});
});
});
Expand Down Expand Up @@ -242,7 +241,7 @@ describe('events', function() {
});

app.store.set({a: {b: {c: 'd'}}});
keys.should.eql(['a']);
assert.deepEqual(keys, ['a']);
});

it('should emit `set` when a key/value pair is set:', function() {
Expand All @@ -253,7 +252,7 @@ describe('events', function() {
});

app.store.set('a', 'b');
keys.should.eql(['a']);
assert.deepEqual(keys, ['a']);
});

it('should emit `set` when an object value is set:', function() {
Expand All @@ -264,7 +263,7 @@ describe('events', function() {
});

app.store.set('a', {b: 'c'});
keys.should.eql(['a']);
assert.deepEqual(keys, ['a']);
});

it('should emit `set` when an array of objects is passed:', function(cb) {
Expand All @@ -275,7 +274,7 @@ describe('events', function() {
});

app.store.set([{a: 'b'}, {c: 'd'}]);
keys.should.eql(['a', 'c']);
assert.deepEqual(keys, ['a', 'c']);
cb();
});

Expand All @@ -293,13 +292,13 @@ describe('events', function() {

it('should emit `del` when a value is delted:', function(cb) {
app.store.on('del', function(keys) {
keys.should.eql('a');
assert.deepEqual(keys, 'a');
assert.equal(typeof app.store.get('a'), 'undefined');
cb();
});

app.store.set('a', {b: 'c'});
app.store.get('a').should.eql({b: 'c'});
assert.deepEqual(app.store.get('a'), {b: 'c'});
app.store.del('a');
});

Expand All @@ -316,17 +315,21 @@ describe('events', function() {
app.store.set('e', 'f');

app.store.del({force: true});
arr.should.eql(['a', 'c', 'e']);
assert.deepEqual(arr, ['a', 'c', 'e']);
cb();
});

it('should throw an error if force is not passed', function() {
it('should throw an error if force is not passed', function(cb) {
app.store.set('a', 'b');
app.store.set('c', 'd');
app.store.set('e', 'f');

(function() {
try {
app.store.del();
}).should.throw('options.force is required to delete the entire cache.');
cb(new Error('expected an error'));
} catch (err) {
assert.equal(err.message, 'options.force is required to delete the entire cache.');
cb();
}
});
});

0 comments on commit 7484daa

Please sign in to comment.