Bring back typedoc
This commit is contained in:
@@ -1,20 +1,20 @@
|
||||
import EventEmitter from "events"
|
||||
import { describe, expect, it, vi, beforeEach, afterEach } from "vitest"
|
||||
import { isRelayUrl } from "@welshman/util"
|
||||
import { LocalRelay, LOCAL_RELAY_URL } from "@welshman/relay"
|
||||
import { LocalRelay, Repository, LOCAL_RELAY_URL } from "@welshman/relay"
|
||||
import { AdapterEvent, SocketAdapter, LocalAdapter, getAdapter } from "../src/adapter"
|
||||
import { ClientMessage, RelayMessage } from "../src/message"
|
||||
import { Socket, SocketEvent } from "../src/socket"
|
||||
import { Pool } from "../src/pool"
|
||||
|
||||
vi.mock('isomorphic-ws', () => {
|
||||
const WebSocket = vi.fn(function () {
|
||||
const WebSocket = vi.fn(function (this: any) {
|
||||
setTimeout(() => this.onopen())
|
||||
})
|
||||
|
||||
WebSocket.prototype.send = vi.fn()
|
||||
|
||||
WebSocket.prototype.close = vi.fn(function () {
|
||||
WebSocket.prototype.close = vi.fn(function (this: any) {
|
||||
this.onclose()
|
||||
})
|
||||
|
||||
@@ -120,12 +120,14 @@ describe("LocalAdapter", () => {
|
||||
|
||||
describe("getAdapter", () => {
|
||||
let pool: Pool
|
||||
let relay: LocalRelay
|
||||
let repository: Repository
|
||||
|
||||
beforeEach(() => {
|
||||
pool = new Pool()
|
||||
relay = new LocalRelay()
|
||||
pool.get = vi.fn().mockReturnValue(new Socket("wss://test.relay"))
|
||||
pool = new Pool({
|
||||
makeSocket: () => new Socket("wss://test.relay"),
|
||||
})
|
||||
|
||||
repository = new Repository()
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
@@ -134,7 +136,7 @@ describe("getAdapter", () => {
|
||||
|
||||
it("should return LocalAdapter for local relay URL", () => {
|
||||
const url = LOCAL_RELAY_URL
|
||||
const adapter = getAdapter(url, { relay })
|
||||
const adapter = getAdapter(url, { repository })
|
||||
expect(adapter).toBeInstanceOf(LocalAdapter)
|
||||
})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user