/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { expect, test } from "vitest"; import { Apideck } from "../index.js"; import { createTestHTTPClient } from "./testclient.js"; test("Taxrates Accounting Tax Rates All", async () => { const testHttpClient = createTestHTTPClient("accounting.taxRatesAll"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.taxRates.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", filter: { assets: true, equity: true, expenses: true, liabilities: true, revenue: true, }, passThrough: { "search": "San Francisco", }, fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getTaxRatesResponse).toBeDefined(); expect(result.getTaxRatesResponse).toEqual({ statusCode: 200, status: "OK", service: "xero", resource: "tax-rates", operation: "all", data: [ { id: "1234", name: "GST on Purchases", code: "ABN", description: "Reduced rate GST Purchases", effectiveTaxRate: 10, totalTaxRate: 10, taxPayableAccountId: "123456", taxRemittedAccountId: "123456", components: [ { id: "10", name: "GST", rate: 10, compound: true, }, { id: "10", name: "GST", rate: 10, compound: true, }, ], type: "NONE", reportTaxType: "NONE", originalTaxRateId: "12345", status: "active", rowVersion: "1-12345", updatedBy: "12345", createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], }, { id: "1234", name: "GST on Purchases", code: "ABN", description: "Reduced rate GST Purchases", effectiveTaxRate: 10, totalTaxRate: 10, taxPayableAccountId: "123456", taxRemittedAccountId: "123456", components: [ { id: "10", name: "GST", rate: 10, compound: true, }, { id: "10", name: "GST", rate: 10, compound: true, }, { id: "10", name: "GST", rate: 10, compound: true, }, ], type: "NONE", reportTaxType: "NONE", originalTaxRateId: "12345", status: "active", rowVersion: "1-12345", updatedBy: "12345", createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], }, { id: "1234", name: "GST on Purchases", code: "ABN", description: "Reduced rate GST Purchases", effectiveTaxRate: 10, totalTaxRate: 10, taxPayableAccountId: "123456", taxRemittedAccountId: "123456", components: [ { id: "10", name: "GST", rate: 10, compound: true, }, ], type: "NONE", reportTaxType: "NONE", originalTaxRateId: "12345", status: "active", rowVersion: "1-12345", updatedBy: "12345", createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: { "0": {}, }, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, ], }, ], meta: { itemsOnPage: 50, cursors: { previous: "em9oby1jcm06OnBhZ2U6OjE=", current: "em9oby1jcm06OnBhZ2U6OjI=", next: "em9oby1jcm06OnBhZ2U6OjM=", }, }, links: { previous: "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjE%3D", current: "https://unify.apideck.com/crm/companies", next: "https://unify.apideck.com/crm/companies?cursor=em9oby1jcm06OnBhZ2U6OjM", }, }); }); test("Taxrates Accounting Tax Rates Add", async () => { const testHttpClient = createTestHTTPClient("accounting.taxRatesAdd"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.taxRates.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", taxRate: { id: "1234", name: "GST on Purchases", code: "ABN", description: "Reduced rate GST Purchases", effectiveTaxRate: 10, totalTaxRate: 10, taxPayableAccountId: "123456", taxRemittedAccountId: "123456", components: [ { id: "10", name: "GST", rate: 10, compound: true, }, { id: "10", name: "GST", rate: 10, compound: true, }, ], type: "NONE", reportTaxType: "NONE", originalTaxRateId: "12345", status: "active", rowVersion: "1-12345", passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: { "0": "", "1": "", "2": "", }, }, ], }, }); expect(result.httpMeta.response.status).toBe(201); expect(result.createTaxRateResponse).toBeDefined(); expect(result.createTaxRateResponse).toEqual({ statusCode: 200, status: "OK", service: "xero", resource: "tax-rates", operation: "add", data: { id: "12345", }, }); }); test("Taxrates Accounting Tax Rates One", async () => { const testHttpClient = createTestHTTPClient("accounting.taxRatesOne"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.taxRates.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getTaxRateResponse).toBeDefined(); expect(result.getTaxRateResponse).toEqual({ statusCode: 200, status: "OK", service: "xero", resource: "tax-rates", operation: "one", data: { id: "1234", name: "GST on Purchases", code: "ABN", description: "Reduced rate GST Purchases", effectiveTaxRate: 10, totalTaxRate: 10, taxPayableAccountId: "123456", taxRemittedAccountId: "123456", components: [ { id: "10", name: "GST", rate: 10, compound: true, }, { id: "10", name: "GST", rate: 10, compound: true, }, { id: "10", name: "GST", rate: 10, compound: true, }, ], type: "NONE", reportTaxType: "NONE", originalTaxRateId: "12345", status: "active", rowVersion: "1-12345", updatedBy: "12345", createdBy: "12345", updatedAt: new Date("2020-09-30T07:43:32.000Z"), createdAt: new Date("2020-09-30T07:43:32.000Z"), passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: true, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: true, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: 10, }, ], }, }); }); test("Taxrates Accounting Tax Rates Update", async () => { const testHttpClient = createTestHTTPClient("accounting.taxRatesUpdate"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.taxRates.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", taxRate: { id: "1234", name: "GST on Purchases", code: "ABN", description: "Reduced rate GST Purchases", effectiveTaxRate: 10, totalTaxRate: 10, taxPayableAccountId: "123456", taxRemittedAccountId: "123456", components: [ { id: "10", name: "GST", rate: 10, compound: true, }, { id: "10", name: "GST", rate: 10, compound: true, }, { id: "10", name: "GST", rate: 10, compound: true, }, ], type: "NONE", reportTaxType: "NONE", originalTaxRateId: "12345", status: "active", rowVersion: "1-12345", passThrough: [ { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: true, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, ], }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.updateTaxRateResponse).toBeDefined(); expect(result.updateTaxRateResponse).toEqual({ statusCode: 200, status: "OK", service: "xero", resource: "tax-rates", operation: "update", data: { id: "12345", }, }); }); test("Taxrates Accounting Tax Rates Delete", async () => { const testHttpClient = createTestHTTPClient("accounting.taxRatesDelete"); const apideck = new Apideck({ serverURL: process.env["TEST_SERVER_URL"] ?? "http://localhost:18080", httpClient: testHttpClient, apiKey: process.env["APIDECK_API_KEY"] ?? "value", }); const result = await apideck.accounting.taxRates.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteTaxRateResponse).toBeDefined(); expect(result.deleteTaxRateResponse).toEqual({ statusCode: 200, status: "OK", service: "xero", resource: "tax-rates", operation: "delete", data: { id: "12345", }, }); });