// Copyright 2015 The Vanadium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.

var test = require('prova');
var arraySet = require('../../../src/lib/array-set');

test('arraySet set', function(t) {
  var arr = ['a', 'b', 'c'];
  var arr2 = ['d', 'e', 'f'];
  var indexOfFoolish = function() { return 2; };
  var indexOfBad = function() { return -2; };

  // Normal Cases
  t.ok(arraySet.set(arr, 'd', true), 'add new item => true');
  t.deepEqual(arr, ['a', 'b', 'c', 'd'], 'added new item to the end');

  t.ok(arraySet.set(arr, 'b', false), 'remove old item => true');
  t.deepEqual(arr, ['a', 'c', 'd'], 'removed old item from its index');

  t.notOk(arraySet.set(arr, 'c', true), 'add old item => false');
  t.deepEqual(arr, ['a', 'c', 'd'], 'add old item => no changes');

  t.notOk(arraySet.set(arr, 'e', false), 'remove new item => false');
  t.deepEqual(arr, ['a', 'c', 'd'], 'remove new item => no changes');

  // Normal Cases with callback
  t.notOk(arraySet.set(arr2, 'g', true, indexOfFoolish),
    'add to existing index => false');
  t.deepEqual(arr2, ['d', 'e', 'f'], 'add to existing index => no changes');

  t.ok(arraySet.set(arr2, 'h', false, indexOfFoolish),
    'remove from existing index => true');
  t.deepEqual(arr2, ['d', 'e'], 'remove from existing index => changed');

  // Error Cases
  t.throws(arraySet.set(arr, 'f', true, indexOfBad), 'invalid index => throws');

  t.end();
});