From 52bc2df658b817499130b7150a9db63ec0cf9784 Mon Sep 17 00:00:00 2001 From: lxsang Date: Mon, 22 Jun 2020 13:11:31 +0200 Subject: [PATCH] add a test on string trimming API --- tests/testcoreAPI.ts | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/testcoreAPI.ts diff --git a/tests/testcoreAPI.ts b/tests/testcoreAPI.ts new file mode 100644 index 0000000..2012861 --- /dev/null +++ b/tests/testcoreAPI.ts @@ -0,0 +1,20 @@ +import * as JQuery from "../src/libs/jquery-3.2.1.min"; +import { OS as _OS_ } from "../dist/antos"; +// some global variable +const _w_ = window as any; +_w_.$ = JQuery; +const OS = _OS_ as any; +_w_.OS = OS; + +interface GenericObject { + [propName: string]: T; +} + +// test the string trim API +test("Test string trim", () => { + let s = "hhhhhhello worddddddd" as any; + expect(s.trimFromLeft("h")).toBe("ello worddddddd"); + expect(s.trimFromRight("d")).toBe("hhhhhhello wor"); + let p = "/this/is/the/path/" as any; + expect(p.trimBy("/")).toBe("this/is/the/path"); +}) \ No newline at end of file