File tree 1 file changed +14
-2
lines changed
src/interview-classics/is-palindrome
1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 1
1
const assert = require ( 'node:assert/strict' )
2
2
const { describe, it } = require ( 'node:test' )
3
+ const { join } = require ( 'path' )
4
+ const { readFileSync } = require ( 'fs' )
3
5
4
- const algorithms = require ( './is-palindrome.repo' )
6
+ const solutions = require ( './is-palindrome.repo' )
7
+
8
+ const bigPalPath = join ( __dirname , '/big-palindrome.txt' )
9
+ const bigPalindrome = readFileSync ( bigPalPath , 'utf-8' )
5
10
6
11
const palindrome = `Anita! LAva :
7
12
la?; tina.`
8
13
9
- algorithms . forEach ( ( { fun, id } ) => {
14
+ solutions . forEach ( ( { fun, id } ) => {
10
15
describe ( `Palindrome test algorithm "${ id } "` , ( ) => {
11
16
it ( 'identifies palinfromes of length 0' , ( ) => {
12
17
assert . equal (
@@ -43,6 +48,13 @@ algorithms.forEach(({ fun, id }) => {
43
48
)
44
49
} )
45
50
51
+ it ( 'identifies a big palindrome' , ( ) => {
52
+ assert . equal (
53
+ fun ( bigPalindrome ) ,
54
+ true
55
+ )
56
+ } )
57
+
46
58
it ( 'identifies sentence-like non-palindromes' , ( ) => {
47
59
assert . equal (
48
60
fun ( 'This is not a palindrome' ) ,
You can’t perform that action at this time.
0 commit comments