Skip to content

Commit 204f548

Browse files
committed
test: add test for big palindrome
1 parent 01d9bad commit 204f548

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/interview-classics/is-palindrome/is-palindrome.test.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,17 @@
11
const assert = require('node:assert/strict')
22
const { 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

611
const 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'),

0 commit comments

Comments
 (0)