Skip to content

Commit ff70754

Browse files
committed
test(EWT-1376): add unit tests for establishing sql session
chose `vitest` as a test runner since it's fast and is emerging as a replacement for jest as the ecosystem moves toward ESM encountered some friction with the package not being declared as "type=module", which i'm working around for now and will fix properly in another PR. extras: - switched to async static factory function for creating a connection - tightened up exports
1 parent 9047971 commit ff70754

10 files changed

+1551
-23
lines changed

.eslintrc.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
{
1515
"ignoreRestSiblings": true
1616
}
17-
]
17+
],
18+
"node/no-unpublished-import": ["error", {
19+
"allowModules": ["vitest", "vitest-fetch-mock"]
20+
}]
1821
}
1922
}

examples/connectionWithDefaults.ts

+9-7
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@
1010

1111
import { Connection, Runtime } from "@/index";
1212

13-
const conn = new Connection({
14-
apiKey:
15-
process.env["WHEROBOTS_API_KEY"] || "00000000-0000-0000-0000-000000000000",
16-
runtime: Runtime.SEDONA,
17-
});
18-
19-
setTimeout(() => conn.close(), 5000);
13+
(async () => {
14+
const conn = await Connection.connect({
15+
apiKey:
16+
process.env["WHEROBOTS_API_KEY"] ||
17+
"00000000-0000-0000-0000-000000000000",
18+
runtime: Runtime.SEDONA,
19+
});
20+
setTimeout(() => conn.close(), 5000);
21+
})();

0 commit comments

Comments
 (0)