/*eslint-env node, mocha*/
const { expect } = require('chai');
const Cache = require('../../lib/default-cache');


describe('default-cache', function() {

  let cache = null;

  beforeEach(() => cache = Cache());

  it('should be a function', () => {
    expect(Cache).to.be.a('function');
  });


  it('should allow me to list all of the keys in the cache', () => {

    cache.set('foo', 'bar');
    cache.set('bar', 'baz');
    cache.set('baz', 'buzz');
    cache.set('buzz', 'boo');

    const actual   = cache.keys();
    const expected = [ 'foo', 'bar', 'baz', 'buzz' ];

    expect(actual).to.eql(expected);

  });


  it('should return the value when set successfully', (done) => {

    const test = 'foobar';

    cache.set('test', test, (err, response) => {

      expect(response).to.eql(test);
      done();

    });

  });


  it('should allow the user to set and retrieve a value', (done) => {

    const key  = 'test';
    const test = 'foobar';

    cache.set(key, test, (err) => {
      if (err) return done(err);

      cache.get(key, (err, response) => {

        if (err) return done(err);

        expect(response).to.eql(test);
        done();

      });

    });

  });

});

@@ -822,32 +822,405 @@
    %7D);%0A%0A  %7D);%0A%0A%0A
+  it('should return the %22same%22 object that is put into the cache',%0A  (done) =%3E %7B%0A%0A    const key = 'test';%0A    const test = %7B foo: 'bar' %7D;%0A%0A    cache.set(key, test, (err) =%3E %7B%0A      if (err) return done(err);%0A%0A      cache.get(key, (err, response) =%3E %7B%0A%0A        if (err) return done(err);%0A%0A        expect(response).to.eql(test);%0A        done();%0A%0A      %7D);%0A%0A    %7D);%0A%0A  %7D);%0A%0A%0A
   it('should all

test for default cache reference