From 686c98ae3688599e15f0b718193b94dd51f79bc5 Mon Sep 17 00:00:00 2001 From: Timo Hocker Date: Mon, 30 Mar 2020 11:10:29 +0200 Subject: [PATCH] add test --- test/index.js | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/index.js b/test/index.js index 553a01a..30d2d4b 100644 --- a/test/index.js +++ b/test/index.js @@ -40,3 +40,14 @@ test ('copy object', (t) => { t.is (copy.foo, 'baz'); t.is (obj.foo, 'bar'); }); + +test ('run regex', (t) => { + const data = 'foobarfoo'; + const regex = /foo/gu; + let count = 0; + util.run_regex(regex,data,(res)=>{ + t.is(res[0], 'foo'); + count++; + }) + t.is(count, 2); +});