Skip to content

Commit f86aace

Browse files
Strong type for test protos.
1 parent f8373ee commit f86aace

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

test/unit/helpers.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,9 @@ if (semver.satisfies(zmq.version, ">= 4.2")) {
1414
/* Windows cannot bind on a ports just above 1014; start higher to be safe. */
1515
let seq = 5000
1616

17-
export function uniqAddress(proto: string) {
17+
type Proto = "ipc" | "tcp" | "udp" | "inproc"
18+
19+
export function uniqAddress(proto: Proto) {
1820
const id = seq++
1921
switch (proto) {
2022
case "ipc": {
@@ -31,7 +33,7 @@ export function uniqAddress(proto: string) {
3133
}
3234
}
3335

34-
export function testProtos(...requested: string[]) {
36+
export function testProtos(...requested: Proto[]) {
3537
const set = new Set(requested)
3638

3739
/* Do not test with ipc if unsupported. */

0 commit comments

Comments
 (0)