-
Notifications
You must be signed in to change notification settings - Fork 895
Commit
… an error
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { expect } from 'chai'; | ||
import { TransportOptions, areTransportOptionsEqual, connectDataConnectEmulator, getDataConnect} from '../../src/api/DataConnect'; | ||
import { app } from '../util'; | ||
import { queryRef } from '../../src'; | ||
describe.only('Transport Options', () => { | ||
it('should return false if transport options are not equal', () => { | ||
Check failure on line 6 in packages/data-connect/test/unit/transportoptions.test.ts GitHub Actions / Lint
Check failure on line 6 in packages/data-connect/test/unit/transportoptions.test.ts GitHub Actions / Test Packages With Changed Files in Chrome and Node
Check failure on line 6 in packages/data-connect/test/unit/transportoptions.test.ts GitHub Actions / Test Packages With Changed Files in Firefox
|
||
const transportOptions1: TransportOptions = { | ||
host: 'h', | ||
port: 1, | ||
sslEnabled: false | ||
}; | ||
const transportOptions2: TransportOptions = { | ||
host: 'h2', | ||
port: 2, | ||
sslEnabled: false | ||
}; | ||
expect(areTransportOptionsEqual(transportOptions1, transportOptions2)).to.eq(false); | ||
}); | ||
it('should return true if transport options are equal', () => { | ||
const transportOptions1: TransportOptions = { | ||
host: 'h', | ||
port: 1, | ||
sslEnabled: false | ||
}; | ||
const transportOptions2: TransportOptions = { | ||
host: 'h', | ||
port: 1, | ||
sslEnabled: false | ||
}; | ||
expect(areTransportOptionsEqual(transportOptions1, transportOptions2)).to.eq(true); | ||
}); | ||
it.only('should throw if emulator is connected to with new transport options', () => { | ||
const dc = getDataConnect(app, { | ||
Check failure on line 33 in packages/data-connect/test/unit/transportoptions.test.ts GitHub Actions / Lint
Check failure on line 33 in packages/data-connect/test/unit/transportoptions.test.ts GitHub Actions / Test Packages With Changed Files in Chrome and Node
Check failure on line 33 in packages/data-connect/test/unit/transportoptions.test.ts GitHub Actions / Test Packages With Changed Files in Firefox
|
||
connector: 'c', | ||
location: 'l', | ||
service: 's' | ||
}); | ||
expect(() => connectDataConnectEmulator(dc, 'h', 80, false)).to.not.throw(); | ||
queryRef(dc, 'query'); | ||
expect(() => connectDataConnectEmulator(dc, 'h2', 80, false)).to.throw('DataConnect instance already initialized!'); | ||
}); | ||
it.only('should not throw if emulator is connected to with the same transport options', () => { | ||
const dc = getDataConnect(app, { | ||
Check failure on line 43 in packages/data-connect/test/unit/transportoptions.test.ts GitHub Actions / Lint
Check failure on line 43 in packages/data-connect/test/unit/transportoptions.test.ts GitHub Actions / Test Packages With Changed Files in Chrome and Node
Check failure on line 43 in packages/data-connect/test/unit/transportoptions.test.ts GitHub Actions / Test Packages With Changed Files in Firefox
|
||
connector: 'c', | ||
location: 'l', | ||
service: 's' | ||
}); | ||
expect(() => connectDataConnectEmulator(dc, 'h', 80, false)).to.not.throw(); | ||
queryRef(dc, 'query'); | ||
expect(() => connectDataConnectEmulator(dc, 'h', 80, false)).to.not.throw(); | ||
}); | ||
}); |