Skip to content

Commit

Permalink
Refactor tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kaklakariada committed Aug 9, 2023
1 parent 804edf8 commit f8b9e7a
Show file tree
Hide file tree
Showing 6 changed files with 266 additions and 221 deletions.
2 changes: 1 addition & 1 deletion extension/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"generate": "bash generate-description.sh",
"lint": "eslint ./src/",
"clean": "rm -rf dist/",
"test": "jest",
"test": "jest --silent",
"test-watch": "jest --watch"
},
"dependencies": {
Expand Down
20 changes: 10 additions & 10 deletions extension/src/adapterScript.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { describe, expect, it } from '@jest/globals';
import { AdapterScript } from './adapterScript';
import { script } from './test-utils';



Expand All @@ -21,16 +22,15 @@ describe("AdapterScript", () => {
describe("methods", () => {
describe("getVersion()", () => {
const tests: { name: string; scriptText: string, expected: string | undefined }[] = [
{ name: "found", scriptText: "CREATE ... %jar /path/to/document-files-virtual-schema-dist-0.0.0-s3-1.2.3.jar; more text", expected: "1.2.3" },
{ name: "found with LF", scriptText: "CREATE ...\n %jar /path/to/document-files-virtual-schema-dist-0.0.0-s3-1.2.3.jar; more text", expected: "1.2.3" },
{ name: "found with LFCR", scriptText: "CREATE ...\n\r %jar /path/to/document-files-virtual-schema-dist-0.0.0-s3-1.2.3.jar; more text", expected: "1.2.3" },
{ name: "with CRLF", scriptText: "CREATE ...\r\n %jar /path/to/document-files-virtual-schema-dist-0.0.0-s3-1.2.3.jar; more text", expected: "1.2.3" },
{ name: "not found in root dir", scriptText: "CREATE ... %jar /document-files-virtual-schema-dist-0.0.0-s3-1.2.3.jar; more text", expected: undefined },
{ name: "not found invalid %jar", scriptText: "CREATE ... %invalid /path/to/document-files-virtual-schema-dist-0.0.0-s3-1.2.3.jar; more text", expected: undefined },
{ name: "not found missing %jar", scriptText: "CREATE ... /path/to/document-files-virtual-schema-dist-0.0.0-s3-1.2.3.jar; more text", expected: undefined },
{ name: "not found missing trailing semicolon", scriptText: "CREATE ...\r\n %jar /path/to/document-files-virtual-schema-dist-0.0.0-s3-1.2.3.jar", expected: undefined },
{ name: "not found invalid vs-common-document-files version", scriptText: "CREATE ... %jar /path/to/document-files-virtual-schema-dist-a.b.c-s3-1.2.3.jar;", expected: undefined },
{ name: "not found invalid version", scriptText: "CREATE ... %jar /path/to/document-files-virtual-schema-dist-0.0.0-s3-a.b.c.jar;", expected: undefined },
{ name: "found", scriptText: "CREATE ... %jar /path/to/exasol-cloud-storage-extension-1.2.3.jar; more text", expected: "1.2.3" },
{ name: "found with LF", scriptText: "CREATE ...\n %jar /path/to/exasol-cloud-storage-extension-1.2.3.jar; more text", expected: "1.2.3" },
{ name: "found with LFCR", scriptText: "CREATE ...\n\r %jar /path/to/exasol-cloud-storage-extension-1.2.3.jar; more text", expected: "1.2.3" },
{ name: "with CRLF", scriptText: "CREATE ...\r\n %jar /path/to/exasol-cloud-storage-extension-1.2.3.jar; more text", expected: "1.2.3" },
{ name: "not found in root dir", scriptText: "CREATE ... %jar /exasol-cloud-storage-extension-1.2.3.jar; more text", expected: undefined },
{ name: "not found invalid %jar", scriptText: "CREATE ... %invalid /path/to/exasol-cloud-storage-extension-1.2.3.jar; more text", expected: undefined },
{ name: "not found missing %jar", scriptText: "CREATE ... /path/to/exasol-cloud-storage-extension-1.2.3.jar; more text", expected: undefined },
{ name: "not found missing trailing semicolon", scriptText: "CREATE ...\r\n %jar /path/to/exasol-cloud-storage-extension-1.2.3.jar", expected: undefined },
{ name: "not found invalid version", scriptText: "CREATE ... %jar /path/to/exasol-cloud-storage-extension-a.b.c.jar;", expected: undefined },
{ name: "not found invalid filename", scriptText: "CREATE ... %jar /path/to/invalid-file-name-dist-0.0.0-s3-1.2.3.jar;", expected: undefined },
]
tests.forEach(test => it(test.name, () => {
Expand Down
Loading

0 comments on commit f8b9e7a

Please sign in to comment.