// let assert = require('assert'); // let util = require('../src/util') import assert from 'assert' import util from '../src/util' describe('Link', function () { describe('#cursorInsideLink', function () { it('should return true when inside link', function () { assert.deepStrictEqual(util.cursorInsideLink("[[test]]", 2), [2, true]); }) it('should return true when inside link position 1', function () { assert.deepStrictEqual(util.cursorInsideLink("[[test]]", 3), [2,true]); }) it('should return true when inside link position 2', function () { assert.deepStrictEqual(util.cursorInsideLink("[[test]]", 4), [2,true]); }) it('should return true when inside link position 3', function () { assert.deepStrictEqual(util.cursorInsideLink("[[test]]", 5), [2,true]); }) it('should return true when inside link position 4', function () { assert.deepStrictEqual(util.cursorInsideLink("[[test]]", 6), [2,true]); }) it('should return false on empty string', function () { assert.strictEqual(util.cursorInsideLink("", 0)[1], false); }); it('should return false before open link inside whitespace', function () { assert.strictEqual(util.cursorInsideLink(" [[", 0)[1], false); }) it('should return false before one space and open link', function () { assert.strictEqual(util.cursorInsideLink(" [[", 0)[1], false); }) it('should return false when before closed link', function () { assert.strictEqual(util.cursorInsideLink("[[test]]", 0)[1], false); }) it('should return false when on closed link start tag', function () { assert.strictEqual(util.cursorInsideLink("[[test]]", 1)[1], false); }) it('should return false when on link end tag', function () { assert.strictEqual(util.cursorInsideLink("[[test]]", 7)[1], false); }) it('should return false when after link end tag', function () { assert.strictEqual(util.cursorInsideLink("[[test]]", 7)[1], false); }) }) })