60 lines
1.7 KiB
TypeScript
60 lines
1.7 KiB
TypeScript
|
|
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);
|
||
|
|
});
|
||
|
|
});
|
||
|
|
});
|