autosuggestion
Version:
  Generates suggestions for text completion.  
48 lines • 1.98 kB
JavaScript
import { isWord, isLookup } from './typegaurds';
describe('typeguard functions', function () {
describe('isWord(...)', function () {
it('returns true given a word', function () {
var word = 'acab';
expect(isWord(word)).toBeTruthy();
});
it('returns false given a lookup', function () {
var lookup = { a: ['c', 'a', 'b'] };
expect(isWord(lookup)).toBeFalsy();
});
it('returns false given a lookup pattern', function () {
var pattern = [{ a: ['c'] }, { a: ['b'] }];
expect(isWord(pattern)).toBeFalsy();
});
it('returns false given a word pattern', function () {
var pattern = ['a11', 'c0pz', 'r', 'b4st4rds'];
expect(isWord(pattern)).toBeFalsy();
});
it('returns false given a word and lookup pattern', function () {
var pattern = ['a', { c: ['a'] }, 'b'];
expect(isWord(pattern)).toBeFalsy();
});
});
describe('isLookup(...)', function () {
it('returns true given a lookup', function () {
var lookup = { a: ['c', 'a', 'b'] };
expect(isLookup(lookup)).toBeTruthy();
});
it('returns false given a word', function () {
var word = 'acab';
expect(isLookup(word)).toBeFalsy();
});
it('returns false given a lookup pattern', function () {
var pattern = [{ a: ['c'] }, { a: ['b'] }];
expect(isLookup(pattern)).toBeFalsy();
});
it('returns false given a word pattern', function () {
var pattern = ['a11', 'c0pz', 'r', 'b4st4rds'];
expect(isLookup(pattern)).toBeFalsy();
});
it('returns false given a word and lookup pattern', function () {
var pattern = ['a', { c: ['a'] }, 'b'];
expect(isLookup(pattern)).toBeFalsy();
});
});
});
//# sourceMappingURL=typegaurds.test.js.map