From 53199ada32f7e7f3c63b176d72c0783c0177484f Mon Sep 17 00:00:00 2001 From: Thomas Luu Date: Wed, 13 Nov 2019 13:37:19 -0500 Subject: [PATCH] Updated sentence count regex --- test/summarize.test.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/summarize.test.js b/test/summarize.test.js index 1bb77e4c13..d973680c10 100644 --- a/test/summarize.test.js +++ b/test/summarize.test.js @@ -13,5 +13,10 @@ describe('summarize tests...', () => { test('summarize returns string', () => expect(typeof predicted).toBe('string')); - test('summarize returns correct number of lines', () => expect(predicted.split('.').length).toBe(6)); + test('summarize returns correct number of lines', () => { + // NOTE: This regex does not catch floating point values properly. + // However, node-summarizer also fails to properly handle floating + // point values in strings, so this regex will suffice for now. + expect(predicted.match(/([^.!?]+[.!?]+)|([^.!?]+$)/g).length).toBe(5); + }); });