All files / src handleMergeError.test.ts

100% Statements 25/25
100% Branches 0/0
100% Functions 8/8
100% Lines 25/25
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 491x 1x   1x   1x 1x 1x   1x     1x 1x   1x     1x 1x   1x     1x 1x   1x     1x   1x   1x     1x 1x   1x     1x 1x   1x    
import * as chai          from 'chai';
import {getTotalMatching} from './handleMergeError';
 
const assert = chai.assert;
 
describe('getTotalMatching()', () => {
    it('should itentify 0 common characters between two unique strings', () => {
        const total = getTotalMatching('foo', 'bar');
 
        assert.equal(total, 0);
    });
 
    it('should itentify all characters as common, between two identical strings', () => {
        const total = getTotalMatching('foo', 'foo');
 
        assert.equal(total, 3);
    });
 
    it('should itentify common characters at the start of two partially identical strings', () => {
        const total = getTotalMatching('foo', 'fooBar');
 
        assert.equal(total, 3);
    });
 
    it('should itentify common characters at the start of two partially identical strings', () => {
        const total = getTotalMatching('fooBar', 'foo');
 
        assert.equal(total, 3);
    });
 
    it(`should itentify common characters at the end of two partially
        identical strings, while ignoring characters of different case`, () => {
        const total = getTotalMatching('bar', 'fooBar');
 
        assert.equal(total, 2);
    });
 
    it(`should itentify common characters in the middle of a string`, () => {
        const total = getTotalMatching('foo', 'barFooBar');
 
        assert.equal(total, 2);
    });
 
    it(`should sum isolated common characters on either side of a string`, () => {
        const total = getTotalMatching('fooBarCar', 'fooBrrCar');
 
        assert.equal(total, 8);
    });
});