Skip to content

Commit

Permalink
add test case for install via SQLcl command
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippSalvisberg committed Nov 26, 2023
1 parent abbddc2 commit e3999df
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions test/mle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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("");
Expand All @@ -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("");
Expand Down

0 comments on commit e3999df

Please sign in to comment.