Skip to content

Commit

Permalink
Test that we can import the Types namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
lawrence-forooghian committed Nov 13, 2023
1 parent 94e44af commit 7598f80
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions test/package/browser/template/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { Realtime } from 'ably';
import { Realtime, Types } from 'ably';
import { createSandboxAblyAPIKey } from './sandbox';

// This function exists to check that we can import the Types namespace and refer to its types.
async function attachChannel(channel: Types.RealtimeChannel) {
await channel.attach();
}

globalThis.testAblyPackage = async function () {
const key = await createSandboxAblyAPIKey();

const realtime = new Realtime({ key, environment: 'sandbox' });

const channel = realtime.channels.get('channel');
await channel.attach();
await attachChannel(channel);

const receivedMessagePromise = new Promise<void>((resolve) => {
channel.subscribe(() => {
Expand Down

0 comments on commit 7598f80

Please sign in to comment.