1
- if ( process . env . INCLUDE_COMPAT_TESTS ) {
2
- const zmq = require ( "./load" )
3
- const { assert} = require ( "chai" )
4
- const { testProtos, uniqAddress} = require ( "../helpers" )
1
+ import * as zmq from "../../../v5-compat"
2
+ import { assert } from "chai"
3
+ import { testProtos , uniqAddress } from "../helpers"
5
4
5
+ if ( process . env . INCLUDE_COMPAT_TESTS ) {
6
6
for ( const proto of testProtos ( "tcp" , "inproc" ) ) {
7
7
describe ( `compat socket with ${ proto } messages` , function ( ) {
8
- let push
9
- let pull
8
+ let push : zmq . Socket
9
+ let pull : zmq . Socket
10
10
11
11
beforeEach ( function ( ) {
12
12
push = zmq . socket ( "push" )
13
13
pull = zmq . socket ( "pull" )
14
14
} )
15
15
16
- it ( "should support messages" , function ( done ) {
17
- const address = uniqAddress ( proto )
16
+ it ( "should support messages" , async function ( done ) {
17
+ const address = await uniqAddress ( proto )
18
18
19
19
let n = 0
20
20
@@ -43,8 +43,8 @@ if (process.env.INCLUDE_COMPAT_TESTS) {
43
43
push . send ( Buffer . from ( "buffer" ) )
44
44
} )
45
45
46
- it ( "should support multipart messages" , function ( done ) {
47
- const address = uniqAddress ( proto )
46
+ it ( "should support multipart messages" , async function ( done ) {
47
+ const address = await uniqAddress ( proto )
48
48
49
49
pull . on ( "message" , function ( msg1 , msg2 , msg3 ) {
50
50
assert . equal ( msg1 . toString ( ) , "string" )
@@ -60,8 +60,8 @@ if (process.env.INCLUDE_COMPAT_TESTS) {
60
60
push . send ( [ "string" , 15.99 , Buffer . from ( "buffer" ) ] )
61
61
} )
62
62
63
- it ( "should support sndmore" , function ( done ) {
64
- const address = uniqAddress ( proto )
63
+ it ( "should support sndmore" , async function ( done ) {
64
+ const address = await uniqAddress ( proto )
65
65
66
66
pull . on ( "message" , function ( a , b , c , d , e ) {
67
67
assert . equal ( a . toString ( ) , "tobi" )
@@ -82,8 +82,8 @@ if (process.env.INCLUDE_COMPAT_TESTS) {
82
82
} )
83
83
84
84
if ( proto != "inproc" ) {
85
- it ( "should handle late connect" , function ( done ) {
86
- const address = uniqAddress ( proto )
85
+ it ( "should handle late connect" , async function ( done ) {
86
+ const address = await uniqAddress ( proto )
87
87
let n = 0
88
88
89
89
pull . on ( "message" , function ( msg ) {
@@ -115,8 +115,8 @@ if (process.env.INCLUDE_COMPAT_TESTS) {
115
115
} )
116
116
}
117
117
118
- it ( "should call send callbacks" , function ( done ) {
119
- const address = uniqAddress ( proto )
118
+ it ( "should call send callbacks" , async function ( done ) {
119
+ const address = await uniqAddress ( proto )
120
120
let received = 0
121
121
let callbacks = 0
122
122
0 commit comments