File tree Expand file tree Collapse file tree 1 file changed +14
-2
lines changed
src/interview-classics/is-palindrome Expand file tree Collapse file tree 1 file changed +14
-2
lines changed Original file line number Diff line number Diff line change 11const assert = require ( 'node:assert/strict' )
22const { describe, it } = require ( 'node:test' )
3+ const { join } = require ( 'path' )
4+ const { readFileSync } = require ( 'fs' )
35
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' )
510
611const palindrome = `Anita! LAva :
712 la?; tina.`
813
9- algorithms . forEach ( ( { fun, id } ) => {
14+ solutions . forEach ( ( { fun, id } ) => {
1015 describe ( `Palindrome test algorithm "${ id } "` , ( ) => {
1116 it ( 'identifies palinfromes of length 0' , ( ) => {
1217 assert . equal (
@@ -43,6 +48,13 @@ algorithms.forEach(({ fun, id }) => {
4348 )
4449 } )
4550
51+ it ( 'identifies a big palindrome' , ( ) => {
52+ assert . equal (
53+ fun ( bigPalindrome ) ,
54+ true
55+ )
56+ } )
57+
4658 it ( 'identifies sentence-like non-palindromes' , ( ) => {
4759 assert . equal (
4860 fun ( 'This is not a palindrome' ) ,
You can’t perform that action at this time.
0 commit comments