text: /*!
   * Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file.
   */
  
  import {assert} from '@ciscospark/test-helper-chai';
  import MockSpark from '@ciscospark/test-helper-mock-spark';
  import Locus, {USE_INCOMING, EQUAL, USE_CURRENT, FETCH} from '@ciscospark/internal-plugin-locus';
  
  describe(`plugin-locus`, () => {
    describe(`Locus`, () => {
      /* eslint max-nested-callbacks: [0] */
      let spark;
  
      beforeEach(() => {
        spark = new MockSpark({
          children: {
            locus: Locus
          }
        });
      });
  
      describe(`#compare()`, () => {
        const data = [
          {
            left: {
              entries: [
                101,
                102,
                103,
                104
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            right: {
              entries: [
                201,
                202,
                203,
                204
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            result: USE_INCOMING
          },
          {
            left: {
              entries: [
                101,
                102,
                103,
                104
              ],
              rangeStart: 90,
              rangeEnd: 95
            },
            right: {
              entries: [
                201,
                202,
                203,
                204
              ],
              rangeStart: 190,
              rangeEnd: 195
            },
            result: USE_INCOMING
          },
          {
            left: {
              entries: [
                101,
                102,
                103,
                104,
                105
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            right: {
              entries: [
                102,
                103,
                104,
                105
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            result: USE_CURRENT
          },
          {
            left: {
              entries: [
                101,
                102,
                103,
                104
              ],
              rangeStart: 80,
              rangeEnd: 95
            },
            right: {
              entries: [
                101,
                102,
                103,
                104
              ],
              rangeStart: 85,
              rangeEnd: 95
            },
            result: USE_CURRENT
          },
          {
            left: {
              entries: [
                101,
                102,
                103,
                104
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            right: {
              entries: [
                101,
                102,
                103,
                104,
                105,
                106
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            result: USE_INCOMING
          },
          {
            left: {
              entries: [
                101,
                102,
                103,
                104
              ],
              rangeStart: 80,
              rangeEnd: 95
            },
            right: {
              entries: [
                101,
                102,
                103,
                104,
                105,
                106
              ],
              rangeStart: 80,
              rangeEnd: 95
            },
            result: USE_INCOMING
          },
          {
            left: {
              entries: [
                101,
                102,
                103,
                104,
                105
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            right: {
              entries: [
                102,
                103,
                104,
                105,
                106,
                107
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            result: USE_INCOMING
          },
          {
            left: {
              entries: [
                100,
                101,
                102,
                103
              ],
              rangeStart: 75,
              rangeEnd: 90
            },
            right: {
              entries: [
                100,
                101,
                102,
                103,
                104,
                105
              ],
              rangeStart: 80,
              rangeEnd: 90
            },
            result: USE_INCOMING
          },
          {
            left: {
              entries: [
                101,
                102,
                103,
                106,
                107
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            right: {
              entries: [
                101,
                102,
                103,
                104,
                105,
                107,
                108
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            result: FETCH
          },
          {
            left: {
              entries: [
                101,
                102,
                103,
                106,
                107
              ],
              rangeStart: 80,
              rangeEnd: 90
            },
            right: {
              entries: [
                101,
                102,
                103,
                104,
                105,
                107,
                108
              ],
              rangeStart: 80,
              rangeEnd: 90
            },
            result: FETCH
          },
          {
            left: {
              entries: [
                101,
                102,
                103,
                104
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            right: {
              entries: [
                101,
                102,
                103,
                105
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            result: FETCH
          },
          {
            left: {
              entries: [
                101,
                102,
                103,
                104
              ],
              rangeStart: 80,
              rangeEnd: 90
            },
            right: {
              entries: [
                101,
                102,
                103,
                105
              ],
              rangeStart: 80,
              rangeEnd: 90
            },
            result: FETCH
          },
          {
            left: {
              entries: [],
              rangeStart: 0,
              rangeEnd: 0
            },
            right: {
              entries: [],
              rangeStart: 0,
              rangeEnd: 0
            },
            result: EQUAL
          },
          {
            left: {
              entries: [
                101,
                102,
                103
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            right: {
              entries: [],
              rangeStart: 0,
              rangeEnd: 0
            },
            result: USE_CURRENT
          },
          {
            left: {
              entries: [
                101,
                102,
                103
              ],
              rangeStart: 80,
              rangeEnd: 95
            },
            right: {
              entries: [],
              rangeStart: 0,
              rangeEnd: 0
            },
            result: USE_CURRENT
          },
          {
            left: {
              entries: [
                101,
                102,
                103,
                104
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            right: {
              entries: [
                101,
                102,
                103,
                104
              ],
              rangeStart: 0,
              rangeEnd: 0
            },
            result: EQUAL
          },
          {
            left: {
              entries: [
                101,
                102,
                103,
                104
              ],
              rangeStart: 50,
              rangeEnd: 75
            },
            right: {
              entries: [
                101,
                102,
                103,
                104
              ],
              rangeStart: 50,
              rangeEnd: 75
            },
            result: EQUAL
          }
        ];
  
        data.forEach(({left, right, result}, index) => {
          it(`correctly sequences reference data ${index}`, () => assert.equal(spark.internal.locus.compare({sequence: left}, {sequence: right}), result));
        });
      });
    });
  });
  