Skip to content

Commit

Permalink
fix(book/hashmap): exercise example and add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amejiarosario committed Dec 22, 2020
1 parent 65b6edd commit c137930
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion book/content/part02/hash-map.asc
Expand Up @@ -486,7 +486,7 @@ function longestSubstring(s) {
.Examples
[source, javascript]
----
longestSubstring('abcdaefg'); // 4 ('abcd' or 'aefg')
longestSubstring('abcdaefg'); // 7 ('bcdaefg')
longestSubstring('abbaa'); // 2 ('ab')
longestSubstring('abbadvdf') // 4 ('badv')
----
Expand Down
Expand Up @@ -20,5 +20,11 @@ const { lenLongestSubstring } = require('./longest-substring-without-repeating-c
const expected = 5;
expect(fn(actual)).toEqual(expected);
});

it('should work with example', () => {
const actual = 'abcdaefg';
const expected = 7;
expect(fn(actual)).toEqual(expected);
});
});
});

0 comments on commit c137930

Please sign in to comment.