From e3999df1f58dacdab6eb6406e0c7eb640d6e60c5 Mon Sep 17 00:00:00 2001 From: Philipp Salvisberg Date: Sun, 26 Nov 2023 09:24:33 +0100 Subject: [PATCH] add test case for install via SQLcl command --- test/mle.test.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/test/mle.test.ts b/test/mle.test.ts index a255df8..2cc7c68 100644 --- a/test/mle.test.ts +++ b/test/mle.test.ts @@ -84,9 +84,7 @@ describe("SQLcl script mle.js", () => { describe("install mle module from file", () => { const file = tempfile({extension: 'js'}); - writeFileSync(file, `export function toEpoch(ts) { - return ts.valueOf(); -}`); + writeFileSync(file, `export function toEpoch(ts) {\n return ts.valueOf();\n}`); it("should install util_mod without version number)", async () => { const actual = await runSqlcl(`script mle.js install util_mod ${file}`); expect(actual.stderr.trim()).equals(""); @@ -107,6 +105,12 @@ describe("SQLcl script mle.js", () => { const modules = await mleSession.execute("select module_name, version from user_mle_modules"); expect(modules.rows).toEqual([["UTIL_MOD", "1.0.0"]]); }, timeout); + it("should install util_mod with version number via SQLcl command)", async () => { + const actual = await runSqlcl(`script mle.js register\nmle install util_mod ${file} 1.2.3`); + expect(actual.stderr.trim()).equals(""); + const modules = await mleSession.execute("select module_name, version from user_mle_modules"); + expect(modules.rows).toEqual([["UTIL_MOD", "1.2.3"]]); + }, timeout); it("should report too many parameters)", async () => { const actual = await runSqlcl(`script mle.js install util_mod ${file} 1.0.0 too-many`); expect(actual.stderr.trim()).equals("");