generated from coulomb/repo-seed
Add Binect SDK implementation, Explorer, and test suite
SDK (@binect/js): - BinectClient with domain sub-clients (documents, sendings, accounts, attachments, invoices) - HTTP Basic Auth, native fetch only (no runtime dependencies) - TypeScript types matching Binect API vocabulary - Status predicates and polling helpers in helpers.ts - Structured error handling (BinectApiError, BinectAuthError) Explorer: - Standalone browser-based API explorer (explorer/index.html) - Interactive testing without code Tests: - Unit tests for client, types, errors, helpers, http - E2E tests for upload/delete and send/cancel workflows Also includes: - Architecture Decision Records (ADRs) - Example DIN 5008 letter PDFs for testing - API specification research notes Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
59
tests/client.test.ts
Normal file
59
tests/client.test.ts
Normal file
@@ -0,0 +1,59 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { BinectClient } from '../src/client.js';
|
||||
import { DocumentsClient } from '../src/clients/documents.js';
|
||||
import { AttachmentsClient } from '../src/clients/attachments.js';
|
||||
import { SendingsClient } from '../src/clients/sendings.js';
|
||||
import { AccountsClient } from '../src/clients/accounts.js';
|
||||
import { InvoicesClient } from '../src/clients/invoices.js';
|
||||
|
||||
describe('BinectClient', () => {
|
||||
it('creates client with required config', () => {
|
||||
const client = new BinectClient({
|
||||
username: 'test@example.com',
|
||||
password: 'password123',
|
||||
});
|
||||
|
||||
expect(client).toBeInstanceOf(BinectClient);
|
||||
});
|
||||
|
||||
it('creates client with custom baseUrl', () => {
|
||||
const client = new BinectClient({
|
||||
username: 'test@example.com',
|
||||
password: 'password123',
|
||||
baseUrl: 'https://custom.api.com/v1',
|
||||
});
|
||||
|
||||
expect(client).toBeInstanceOf(BinectClient);
|
||||
});
|
||||
|
||||
describe('sub-clients', () => {
|
||||
let client: BinectClient;
|
||||
|
||||
beforeAll(() => {
|
||||
client = new BinectClient({
|
||||
username: 'test@example.com',
|
||||
password: 'password123',
|
||||
});
|
||||
});
|
||||
|
||||
it('has documents client', () => {
|
||||
expect(client.documents).toBeInstanceOf(DocumentsClient);
|
||||
});
|
||||
|
||||
it('has attachments client', () => {
|
||||
expect(client.attachments).toBeInstanceOf(AttachmentsClient);
|
||||
});
|
||||
|
||||
it('has sendings client', () => {
|
||||
expect(client.sendings).toBeInstanceOf(SendingsClient);
|
||||
});
|
||||
|
||||
it('has accounts client', () => {
|
||||
expect(client.accounts).toBeInstanceOf(AccountsClient);
|
||||
});
|
||||
|
||||
it('has invoices client', () => {
|
||||
expect(client.invoices).toBeInstanceOf(InvoicesClient);
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user