UNPKG

dist-javascript-algorithms-and-data-structures

Version:

Algorithms and data-structures implemented on JavaScript

22 lines (19 loc) 1.39 kB
"use strict"; var _longestCommonSubstring = _interopRequireDefault(require("../longestCommonSubstring")); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } describe('longestCommonSubstring', () => { it('should find longest common substring between two strings', () => { expect((0, _longestCommonSubstring.default)('', '')).toBe(''); expect((0, _longestCommonSubstring.default)('ABC', '')).toBe(''); expect((0, _longestCommonSubstring.default)('', 'ABC')).toBe(''); expect((0, _longestCommonSubstring.default)('ABABC', 'BABCA')).toBe('BABC'); expect((0, _longestCommonSubstring.default)('BABCA', 'ABCBA')).toBe('ABC'); expect((0, _longestCommonSubstring.default)('Algorithms and data structures implemented in JavaScript', 'Here you may find Algorithms and data structures that are implemented in JavaScript')).toBe('Algorithms and data structures '); }); it('should handle unicode correctly', () => { expect((0, _longestCommonSubstring.default)('𐌵𐌵**ABC', '𐌵𐌵--ABC')).toBe('ABC'); expect((0, _longestCommonSubstring.default)('𐌵𐌵**A', '𐌵𐌵--A')).toBe('𐌵𐌵'); expect((0, _longestCommonSubstring.default)('A买B时', '买B时GD')).toBe('买B时'); expect((0, _longestCommonSubstring.default)('After test买时 case', 'another_test买时')).toBe('test买时'); }); });