diff --git a/test/unit/account/test_account-service.ts b/test/unit/account/test_account-service.ts index 62e1132..49ac65e 100644 --- a/test/unit/account/test_account-service.ts +++ b/test/unit/account/test_account-service.ts @@ -69,6 +69,7 @@ describe('account service', () => { it(`can create account`, async () => { const account = await accountService.create(); assert(account instanceof Account); + assert(account.id != undefined); assert(account.created_at != undefined); assert(account.created_at == account.updated_at); @@ -214,6 +215,7 @@ describe('account service', () => { await accountService.disable(account.id, true, "spam"); account = await accountService.get(account.id); + assert(account?.id != undefined); assert(account?.status.disabled == true); assert(account?.status.disabled_at != undefined); assert(account?.status.disabled_reason == "spam"); diff --git a/test/unit/ingress/test_http_ingress.ts b/test/unit/ingress/test_http_ingress.ts index 0b2fdb1..6a87fe1 100644 --- a/test/unit/ingress/test_http_ingress.ts +++ b/test/unit/ingress/test_http_ingress.ts @@ -69,8 +69,8 @@ describe('http ingress', () => { account = await accountService.create(); assert(account != undefined); const tunnelId = crypto.randomBytes(20).toString('hex'); - tunnel = await tunnelService.create(tunnelId, account.id); - tunnel = await tunnelService.update(tunnel.id, account.id, (tunnel) => { + tunnel = await tunnelService.create(tunnelId, account.id); + tunnel = await tunnelService.update(tunnelId, account.id, (tunnel) => { tunnel.ingress.http.enabled = true; }); @@ -121,6 +121,8 @@ describe('http ingress', () => { const connectTunnel = async (): Promise => { assert(tunnel != undefined); assert(account != undefined); + assert(tunnel.id != undefined); + assert(account.id != undefined); let res = await tunnelService.connect(tunnel.id, account.id, transport, {peer: "127.0.0.1"}); assert(res == true, "failed to connect tunnel"); @@ -137,6 +139,8 @@ describe('http ingress', () => { it('can send traffic', async () => { assert(tunnel != undefined); assert(account != undefined); + assert(tunnel.id != undefined); + assert(account.id != undefined); client.on('connection', (sock: Duplex) => { const targetSock = new net.Socket(); @@ -206,6 +210,8 @@ describe('http ingress', () => { it('agent does not timeout during transfer', async () => { assert(tunnel != undefined); assert(account != undefined); + assert(tunnel.id != undefined); + assert(account.id != undefined); let res = await tunnelService.connect(tunnel.id, account.id, transport, {peer: "127.0.0.1"}); assert(res == true, "failed to connect tunnel"); @@ -259,6 +265,8 @@ describe('http ingress', () => { it('agent timeout on idle', async () => { assert(tunnel != undefined); assert(account != undefined); + assert(tunnel.id != undefined); + assert(account.id != undefined); forwardTo("localhost", 20000); await connectTunnel(); @@ -288,6 +296,8 @@ describe('http ingress', () => { it(`http ingress can handle websocket upgrades`, async () => { assert(tunnel != undefined); assert(account != undefined); + assert(tunnel.id != undefined); + assert(account.id != undefined); client.on('connection', (sock: Duplex) => { const targetSock = new net.Socket(); @@ -358,6 +368,8 @@ describe('http ingress', () => { it('handles ingress altname', async () => { assert(tunnel != undefined); assert(account != undefined); + assert(tunnel.id != undefined); + assert(account.id != undefined); sinon.stub(dns, 'resolveCname') .withArgs('custom-name.example') @@ -369,6 +381,9 @@ describe('http ingress', () => { ] }); + assert(tunnel instanceof Tunnel); + assert(tunnel.id != undefined); + forwardTo("localhost", 20000); await connectTunnel(); @@ -392,6 +407,8 @@ describe('http ingress', () => { it('adding altname without cname throws error', async () => { assert(tunnel != undefined); assert(account != undefined); + assert(tunnel.id != undefined); + assert(account.id != undefined); let error: CustomError | undefined; try { @@ -411,6 +428,8 @@ describe('http ingress', () => { it('adding altname with wrong cname throws error', async () => { assert(tunnel != undefined); assert(account != undefined); + assert(tunnel.id != undefined); + assert(account.id != undefined); sinon.stub(dns, 'resolveCname') .withArgs('custom-name.example') @@ -436,6 +455,8 @@ describe('http ingress', () => { it('request headers are rewritten with the target host for http', async () => { assert(tunnel != undefined); assert(account != undefined); + assert(tunnel.id != undefined); + assert(account.id != undefined); tunnel = await tunnelService.update(tunnel.id, account?.id, (config) => { config.target.url = "https://echo.localhost.example"