Skip to main content
Glama
basic-autotask-connection.test.ts2.5 kB
// Basic Autotask Connection Test // This test validates that we can connect to the Autotask API using autotask-node import { AutotaskClient } from 'autotask-node'; describe('Autotask Connection Tests', () => { let client: AutotaskClient; beforeAll(async () => { // Skip tests if no credentials are provided if (!process.env.AUTOTASK_USERNAME || !process.env.AUTOTASK_SECRET || !process.env.AUTOTASK_INTEGRATION_CODE) { console.log('Skipping Autotask connection tests - no credentials provided'); return; } try { client = await AutotaskClient.create({ username: process.env.AUTOTASK_USERNAME, secret: process.env.AUTOTASK_SECRET, integrationCode: process.env.AUTOTASK_INTEGRATION_CODE, }); } catch (error) { console.log('Failed to create Autotask client:', error); } }); test('should create AutotaskClient instance', () => { if (!process.env.AUTOTASK_USERNAME) { console.log('Skipping test - no credentials'); return; } expect(client).toBeDefined(); }); test('should be able to get companies (mock test)', async () => { // This is a mock test to verify our types work const mockCompany = { id: 1, companyName: 'Test Company', companyType: 1, isActive: true, createDate: '2023-01-01T00:00:00Z', lastModifiedDate: '2023-01-01T00:00:00Z' }; expect(mockCompany.id).toBe(1); expect(mockCompany.companyName).toBe('Test Company'); expect(typeof mockCompany.isActive).toBe('boolean'); }); test('should be able to create ticket data structure', () => { const mockTicket = { id: 123, ticketNumber: 'T20230001', companyID: 1, title: 'Test Ticket', status: 1, priority: 2, ticketType: 1, createDate: '2023-01-01T00:00:00Z' }; expect(mockTicket.id).toBe(123); expect(mockTicket.ticketNumber).toBe('T20230001'); expect(mockTicket.companyID).toBe(1); }); test('should handle contact data structure', () => { const mockContact = { id: 456, companyID: 1, firstName: 'John', lastName: 'Doe', emailAddress: 'john.doe@example.com', isActive: true, createDate: '2023-01-01T00:00:00Z', lastModifiedDate: '2023-01-01T00:00:00Z' }; expect(mockContact.firstName).toBe('John'); expect(mockContact.lastName).toBe('Doe'); expect(mockContact.emailAddress).toBe('john.doe@example.com'); }); });

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/asachs01/autotask-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server