<commit_before>'use strict';
var assert = require('power-assert');
var removeStorages = require('./');

it('should one argument', function () {
  assert.deepEqual(removeStorages('unicorns'), ['unicorns']);
});
it('should three arguments', function () {
  assert.deepEqual(removeStorages('unicorns', 'flower'), ['unicorns', 'flower']);
});

describe('#localStorage', function () {
  beforeEach(function (done) {
    localStorage.clear();
    done();
  });
  it('should save value', function () {
    var expected = { foo: 'bar', goo: 'nuu' };
    localStorage.setItem('item', JSON.stringify(expected));
    assert.deepEqual(expected, JSON.parse(localStorage.getItem('item')));
  });
  it('should clear value', function (done) {
    var input = { foo: 'bar', goo: 'nuu' };
    localStorage.setItem('item', JSON.stringify(input));
    removeStorages
      .localStorage()
      .then(function () {
      assert.equal(null, localStorage.getItem('item'));
      done();
    });
  });
});

describe('#indexedDB', function () {
  beforeEach(function (done) {
    indexedDB.deleteDatabase('test-item');
    done();
  });

  // http://dev.classmethod.jp/ria/html5/html5-indexed-database-api/
  it('should save value', function (done) {
    var db;
    var openRequest = indexedDB.open('test-item', 2);
    var key = 'foo';
    var value = 'bar';
    var expected = {};
    expected[key] = value;

    openRequest.onupgradeneeded = function(event) {
      db = event.target.result;
      var store = db.createObjectStore('mystore', { keyPath: 'mykey'});
      store.createIndex('myvalueIndex', 'myvalue');<commit_msg>chore(indexeddb): throw error<commit_after>'use strict';
var assert = require('power-assert');
var removeStorages = require('./');

it('should one argument', function () {
  assert.deepEqual(removeStorages('unicorns'), ['unicorns']);
});
it('should three arguments', function () {
  assert.deepEqual(removeStorages('unicorns', 'flower'), ['unicorns', 'flower']);
});

describe('#localStorage', function () {
  beforeEach(function (done) {
    localStorage.clear();
    done();
  });
  it('should save value', function () {
    var expected = { foo: 'bar', goo: 'nuu' };
    localStorage.setItem('item', JSON.stringify(expected));
    assert.deepEqual(expected, JSON.parse(localStorage.getItem('item')));
  });
  it('should clear value', function (done) {
    var input = { foo: 'bar', goo: 'nuu' };
    localStorage.setItem('item', JSON.stringify(input));
    removeStorages
      .localStorage()
      .then(function () {
      assert.equal(null, localStorage.getItem('item'));
      done();
    });
  });
});

describe('#indexedDB', function () {
  beforeEach(function (done) {
    indexedDB.deleteDatabase('test-item');
    done();
  });

  // http://dev.classmethod.jp/ria/html5/html5-indexed-database-api/
  it('should save value', function (done) {
    var db;
    if (!indexedDB) {
      throw new Error('Your browser doesn\'t support a stable version of IndexedDB.');
    }
    var openRequest = indexedDB.open('test-item', 2);
    var key = 'foo';
    var value = 'bar';
    var expected = {};
    expected[key] = value;

    openRequest.onupgradeneeded = function(event) {
      db = event.target.result;
      var store = db.createObjectStore('mystore', { keyPath: 'mykey'});
      store.createIndex('myvalueIndex', 'myvalue');
{'fraction_non_alphanumeric': 0.18415545590433482, 'fraction_numerical': 0.0017937219730941704, 'mean_word_length': 3.891812865497076, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5113704', 'n_tokens_mistral': 1065, 'n_tokens_neox': 1047, 'n_words': 214}