var assert = require('chai').assert;
var first = require('../first.js');

describe('first.js', function () {
    it('Adding 2 numbers works', function () {
        assert.equal(first.addNumbers(3, 4), 7);
    });
    it('Adding 2 numbers results in number', function () {
        assert.typeOf(first.addNumbers(3, 4), 'number');
    });
    it('Subtract 2 numbers works', function () {
        assert.equal(first.subtractNumbers(4, 3), 1);
    });
    it('should return hello world ', function () {
        assert.equal(first.message(), 'hello world');
    });
});

describe('getLocalStorageItem', function () {
    it('should return item', function () {
      window.localStorage.setItem("e", "f");
      assert.equal("f", first.getLocalStorageItem("e"));
      window.localStorage.removeItem("e");
    });
    it('should return item as string value', function () {
      window.localStorage.setItem("g", "h");
      assert.typeOf(first.getLocalStorageItem("g"), 'string');
      window.localStorage.removeItem("g");
    });
    it('should return item as string value', function () {
      window.localStorage.setItem("myKey2", "myValue2");
      assert.isString(first.getLocalStorageItem("myKey2"), 'Item is string');
      window.localStorage.removeItem("myKey2");
    });
  });

