@unito/integration-sdk
Version:
Integration SDK
35 lines (26 loc) • 891 B
text/typescript
import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import Integration from '../src/integration.js';
describe('Integration', () => {
describe('constructor', () => {
it('defaults to port 9200', () => {
const integration = new Integration();
assert.equal(integration['port'], 9200);
});
it('accepts an optional port', () => {
const integration = new Integration({ port: 1234 });
assert.equal(integration['port'], 1234);
});
});
describe('addHandler', () => {
it('works', () => {
const integration = new Integration();
integration.addHandler('/', {});
const handler = integration['handlers'][0];
assert.ok(handler);
assert.equal(handler['path'], '/');
assert.equal(handler['pathWithIdentifier'], '/');
assert.deepEqual(handler['handlers'], {});
});
});
});