@furystack/websocket-api
Advanced tools
Comparing version 9.0.16 to 9.0.17
@@ -6,7 +6,11 @@ import { usingAsync } from '@furystack/utils'; | ||
import { WebSocketApiSettings } from './websocket-api-settings.js'; | ||
import { getPort } from '@furystack/core/port-generator'; | ||
describe('WebSocket Helpers', () => { | ||
it('Should register the settings', async () => { | ||
await usingAsync(new Injector(), async (i) => { | ||
useWebsockets(i); | ||
expect(i.cachedSingletons.has(WebSocketApiSettings)).toBeTruthy(); | ||
const port = getPort(); | ||
useWebsockets(i, { port }); | ||
const settings = i.getInstance(WebSocketApiSettings); | ||
expect(settings.port).toBe(port); | ||
expect(settings.path).toBe('/socket'); | ||
}); | ||
@@ -13,0 +17,0 @@ }); |
@@ -13,3 +13,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
let WebSocketApiSettings = class WebSocketApiSettings { | ||
port = 19090; | ||
port = 80; | ||
host; | ||
@@ -16,0 +16,0 @@ path = '/socket'; |
@@ -13,10 +13,3 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
import { describe, it, expect } from 'vitest'; | ||
const portGenerator = function* () { | ||
const initialPort = 19998; | ||
let port = initialPort; | ||
while (true) { | ||
yield port++; | ||
} | ||
}; | ||
const getPort = () => portGenerator().next().value; | ||
import { getPort } from '@furystack/core/port-generator'; | ||
describe('WebSocketApi', () => { | ||
@@ -23,0 +16,0 @@ it('Should be built', async () => { |
@@ -9,10 +9,3 @@ import { Injector } from '@furystack/inject'; | ||
import { describe, it, expect, beforeEach, afterEach } from 'vitest'; | ||
const portGenerator = function* () { | ||
const initialPort = 19000; | ||
let port = initialPort; | ||
while (true) { | ||
yield port++; | ||
} | ||
}; | ||
const getPort = () => portGenerator().next().value; | ||
import { getPort } from '@furystack/core/port-generator'; | ||
describe('WebSocket Integration tests', () => { | ||
@@ -19,0 +12,0 @@ const host = 'localhost'; |
{ | ||
"name": "@furystack/websocket-api", | ||
"version": "9.0.16", | ||
"version": "9.0.17", | ||
"description": "HTTP Api FuryStack package", | ||
@@ -37,6 +37,6 @@ "type": "module", | ||
"dependencies": { | ||
"@furystack/core": "^12.0.14", | ||
"@furystack/inject": "^8.1.4", | ||
"@furystack/rest-service": "^7.0.16", | ||
"@furystack/utils": "^4.0.13", | ||
"@furystack/core": "^12.0.15", | ||
"@furystack/inject": "^8.1.5", | ||
"@furystack/rest-service": "^7.0.17", | ||
"@furystack/utils": "^4.0.14", | ||
"ws": "^8.16.0" | ||
@@ -47,5 +47,5 @@ }, | ||
"typescript": "^5.3.3", | ||
"vitest": "^1.1.3" | ||
"vitest": "^1.2.1" | ||
}, | ||
"gitHead": "1045d854bfd8c475b7035471d130d401417a2321" | ||
} |
@@ -6,2 +6,3 @@ import { usingAsync } from '@furystack/utils' | ||
import { WebSocketApiSettings } from './websocket-api-settings.js' | ||
import { getPort } from '@furystack/core/port-generator' | ||
@@ -11,6 +12,9 @@ describe('WebSocket Helpers', () => { | ||
await usingAsync(new Injector(), async (i) => { | ||
useWebsockets(i) | ||
expect(i.cachedSingletons.has(WebSocketApiSettings)).toBeTruthy() | ||
const port = getPort() | ||
useWebsockets(i, { port }) | ||
const settings = i.getInstance(WebSocketApiSettings) | ||
expect(settings.port).toBe(port) | ||
expect(settings.path).toBe('/socket') | ||
}) | ||
}) | ||
}) |
@@ -11,3 +11,3 @@ import type { Constructable } from '@furystack/inject' | ||
export class WebSocketApiSettings { | ||
public port = 19090 | ||
public port = 80 | ||
public host?: string | ||
@@ -14,0 +14,0 @@ public path = '/socket' |
@@ -8,13 +8,4 @@ import { Injector, Injectable } from '@furystack/inject' | ||
import { describe, it, expect } from 'vitest' | ||
import { getPort } from '@furystack/core/port-generator' | ||
const portGenerator = function* () { | ||
const initialPort = 19998 | ||
let port = initialPort | ||
while (true) { | ||
yield port++ | ||
} | ||
} | ||
const getPort = () => portGenerator().next().value | ||
describe('WebSocketApi', () => { | ||
@@ -21,0 +12,0 @@ it('Should be built', async () => { |
@@ -9,13 +9,4 @@ import { Injector } from '@furystack/inject' | ||
import { describe, it, expect, beforeEach, afterEach } from 'vitest' | ||
import { getPort } from '@furystack/core/port-generator' | ||
const portGenerator = function* () { | ||
const initialPort = 19000 | ||
let port = initialPort | ||
while (true) { | ||
yield port++ | ||
} | ||
} | ||
const getPort = () => portGenerator().next().value | ||
describe('WebSocket Integration tests', () => { | ||
@@ -22,0 +13,0 @@ const host = 'localhost' |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
92504
1059
Updated@furystack/core@^12.0.15
Updated@furystack/inject@^8.1.5
Updated@furystack/utils@^4.0.14