/* * 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("Bankfeedaccounts Accounting Bank Feed Accounts All", async () => { const testHttpClient = createTestHTTPClient("accounting.bankFeedAccountsAll"); 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.bankFeedAccounts.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", passThrough: { "search": "San Francisco", }, fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getBankFeedAccountsResponse).toBeDefined(); expect(result.getBankFeedAccountsResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "bank-feed-accounts", operation: "all", data: [ { id: "12345", bankAccountType: "bank", sourceAccountId: "src_456", targetAccountId: "tgt_789", targetAccountName: "Main Company Checking", targetAccountNumber: "NL91ABNA0417164300", currency: "USD", feedStatus: "pending", country: "US", customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: 10, }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), updatedBy: "12345", createdBy: "12345", }, { id: "12345", bankAccountType: "bank", sourceAccountId: "src_456", targetAccountId: "tgt_789", targetAccountName: "Main Company Checking", targetAccountNumber: "NL91ABNA0417164300", currency: "USD", feedStatus: "pending", country: "US", customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), updatedBy: "12345", createdBy: "12345", }, { id: "12345", bankAccountType: "bank", sourceAccountId: "src_456", targetAccountId: "tgt_789", targetAccountName: "Main Company Checking", targetAccountNumber: "NL91ABNA0417164300", currency: "USD", feedStatus: "pending", country: "US", customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: "Uses Salesforce and Marketo", }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), updatedBy: "12345", createdBy: "12345", }, ], 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("Bankfeedaccounts Accounting Bank Feed Accounts Add", async () => { const testHttpClient = createTestHTTPClient("accounting.bankFeedAccountsAdd"); 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.bankFeedAccounts.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", bankFeedAccount: { bankAccountType: "bank", sourceAccountId: "src_456", targetAccountId: "tgt_789", targetAccountName: "Main Company Checking", targetAccountNumber: "NL91ABNA0417164300", currency: "USD", feedStatus: "pending", country: "US", customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: true, }, ], }, }); expect(result.httpMeta.response.status).toBe(201); expect(result.createBankFeedAccountResponse).toBeDefined(); expect(result.createBankFeedAccountResponse).toEqual({ statusCode: 200, status: "OK", service: "xero", resource: "bills", operation: "add", data: { id: "12345", }, }); }); test("Bankfeedaccounts Accounting Bank Feed Accounts One", async () => { const testHttpClient = createTestHTTPClient("accounting.bankFeedAccountsOne"); 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.bankFeedAccounts.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getBankFeedAccountResponse).toBeDefined(); expect(result.getBankFeedAccountResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "bank-feed-accounts", operation: "one", data: { id: "12345", bankAccountType: "bank", sourceAccountId: "src_456", targetAccountId: "tgt_789", targetAccountName: "Main Company Checking", targetAccountNumber: "NL91ABNA0417164300", currency: "USD", feedStatus: "pending", country: "US", 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: {}, }, ], createdAt: new Date("2020-09-30T07:43:32.000Z"), updatedAt: new Date("2020-09-30T07:43:32.000Z"), updatedBy: "12345", createdBy: "12345", }, }); }); test("Bankfeedaccounts Accounting Bank Feed Accounts Update", async () => { const testHttpClient = createTestHTTPClient( "accounting.bankFeedAccountsUpdate", ); 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.bankFeedAccounts.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", bankFeedAccount: { bankAccountType: "bank", sourceAccountId: "src_456", targetAccountId: "tgt_789", targetAccountName: "Main Company Checking", targetAccountNumber: "NL91ABNA0417164300", currency: "USD", feedStatus: "pending", country: "US", customFields: [ { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: {}, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: true, }, { id: "2389328923893298", name: "employee_level", description: "Employee Level", value: { "0": {}, "1": {}, }, }, ], }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.updateBankFeedAccountResponse).toBeDefined(); expect(result.updateBankFeedAccountResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "bank-feed-accounts", operation: "update", data: { id: "12345", }, }); }); test("Bankfeedaccounts Accounting Bank Feed Accounts Delete", async () => { const testHttpClient = createTestHTTPClient( "accounting.bankFeedAccountsDelete", ); 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.bankFeedAccounts.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteBankFeedAccountResponse).toBeDefined(); expect(result.deleteBankFeedAccountResponse).toEqual({ statusCode: 200, status: "OK", service: "quickbooks", resource: "bank-feed-accounts", operation: "delete", data: { id: "12345", }, }); });