From 49e0fe19c51af5fa2179de13bb9e239813db3146 Mon Sep 17 00:00:00 2001 From: Stephen Paul Weber Date: Wed, 8 Jan 2025 11:36:43 -0500 Subject: [PATCH] e2e test for stream management --- test/stream-management.js | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 test/stream-management.js diff --git a/test/stream-management.js b/test/stream-management.js new file mode 100644 index 00000000..4713fd5e --- /dev/null +++ b/test/stream-management.js @@ -0,0 +1,38 @@ +import { client } from "../packages/client/index.js"; +import debug from "../packages/debug/index.js"; +import server from "../server/index.js"; + +const username = "client"; +const password = "foobar"; +const credentials = { username, password }; +const domain = "localhost"; + +let xmpp; + +afterEach(async () => { + await xmpp?.stop(); + await server.reset(); +}); + +test("client ack stanzas", async () => { + expect.assertions(1); + + await server.enableModules(["smacks"]); + await server.restart(); + + xmpp = client({ credentials, service: domain }); + debug(xmpp); + + xmpp.streamManagement.on("ack", (el) => { + expect(el.attrs.id).toEqual("ping"); + xmpp.streamManagement._teardown(); + xmpp.stop(); + }); + + await xmpp.start(); + await xmpp.send( + + + , + ); +});