/* * 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("Payrolls Hris Payrolls All", async () => { const testHttpClient = createTestHTTPClient("hris.payrollsAll"); 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.hris.payrolls.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", filter: { startDate: "2022-04-08", endDate: "2022-04-21", }, passThrough: { "search": "San Francisco", }, fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getPayrollsResponse).toBeDefined(); expect(result.getPayrollsResponse).toEqual({ statusCode: 200, status: "OK", service: "sage-hr", resource: "Employees", operation: "all", data: [ { id: "12345", companyId: "23456", processed: false, processedDate: "2022-04-08", checkDate: "2022-04-08", startDate: "2022-04-08", endDate: "2022-04-21", totals: { companyDebit: 27992.49, taxDebit: 8655.32, checkAmount: 27966.23, netPay: 19337.17, grossPay: 27966.23, employerTaxes: 2038.93, employeeTaxes: 6616.39, employerBenefitContributions: 0, employeeBenefitDeductions: 0, }, compensations: [ { employeeId: "12345", netPay: 2199.93, grossPay: 3000, taxes: [ { name: "CA State Income Tax", employer: false, amount: 1.97, }, { name: "CA State Income Tax", employer: false, amount: 1.97, }, { name: "CA State Income Tax", employer: false, amount: 1.97, }, ], deductions: [ { name: "Company Car", amount: 10.97, }, ], benefits: [ { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, ], }, { employeeId: "12345", netPay: 2199.93, grossPay: 3000, taxes: [ { name: "CA State Income Tax", employer: false, amount: 1.97, }, ], deductions: [ { name: "Company Car", amount: 10.97, }, { name: "Company Car", amount: 10.97, }, ], benefits: [ { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, ], }, ], }, { id: "12345", companyId: "23456", processed: false, processedDate: "2022-04-08", checkDate: "2022-04-08", startDate: "2022-04-08", endDate: "2022-04-21", totals: { companyDebit: 27992.49, taxDebit: 8655.32, checkAmount: 27966.23, netPay: 19337.17, grossPay: 27966.23, employerTaxes: 2038.93, employeeTaxes: 6616.39, employerBenefitContributions: 0, employeeBenefitDeductions: 0, }, compensations: [ { employeeId: "12345", netPay: 2199.93, grossPay: 3000, taxes: [ { name: "CA State Income Tax", employer: false, amount: 1.97, }, { name: "CA State Income Tax", employer: false, amount: 1.97, }, { name: "CA State Income Tax", employer: false, amount: 1.97, }, ], deductions: [ { name: "Company Car", amount: 10.97, }, ], benefits: [ { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, ], }, ], }, { id: "12345", companyId: "23456", processed: false, processedDate: "2022-04-08", checkDate: "2022-04-08", startDate: "2022-04-08", endDate: "2022-04-21", totals: { companyDebit: 27992.49, taxDebit: 8655.32, checkAmount: 27966.23, netPay: 19337.17, grossPay: 27966.23, employerTaxes: 2038.93, employeeTaxes: 6616.39, employerBenefitContributions: 0, employeeBenefitDeductions: 0, }, compensations: [ { employeeId: "12345", netPay: 2199.93, grossPay: 3000, taxes: [ { name: "CA State Income Tax", employer: false, amount: 1.97, }, { name: "CA State Income Tax", employer: false, amount: 1.97, }, ], deductions: [ { name: "Company Car", amount: 10.97, }, { name: "Company Car", amount: 10.97, }, ], benefits: [ { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, ], }, { employeeId: "12345", netPay: 2199.93, grossPay: 3000, taxes: [ { name: "CA State Income Tax", employer: false, amount: 1.97, }, ], deductions: [ { name: "Company Car", amount: 10.97, }, { name: "Company Car", amount: 10.97, }, ], benefits: [ { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, ], }, { employeeId: "12345", netPay: 2199.93, grossPay: 3000, taxes: [ { name: "CA State Income Tax", employer: false, amount: 1.97, }, ], deductions: [ { name: "Company Car", amount: 10.97, }, { name: "Company Car", amount: 10.97, }, { name: "Company Car", amount: 10.97, }, ], benefits: [ { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, ], }, ], }, ], }); }); test("Payrolls Hris Payrolls One", async () => { const testHttpClient = createTestHTTPClient("hris.payrollsOne"); 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.hris.payrolls.get({ payrollId: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getPayrollResponse).toBeDefined(); expect(result.getPayrollResponse).toEqual({ statusCode: 200, status: "OK", service: "undefined", resource: "Companies", operation: "one", data: { id: "12345", companyId: "23456", processed: false, processedDate: "2022-04-08", checkDate: "2022-04-08", startDate: "2022-04-08", endDate: "2022-04-21", totals: { companyDebit: 27992.49, taxDebit: 8655.32, checkAmount: 27966.23, netPay: 19337.17, grossPay: 27966.23, employerTaxes: 2038.93, employeeTaxes: 6616.39, employerBenefitContributions: 0, employeeBenefitDeductions: 0, }, compensations: [ { employeeId: "12345", netPay: 2199.93, grossPay: 3000, taxes: [ { name: "CA State Income Tax", employer: false, amount: 1.97, }, { name: "CA State Income Tax", employer: false, amount: 1.97, }, ], deductions: [ { name: "Company Car", amount: 10.97, }, { name: "Company Car", amount: 10.97, }, ], benefits: [ { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, ], }, { employeeId: "12345", netPay: 2199.93, grossPay: 3000, taxes: [ { name: "CA State Income Tax", employer: false, amount: 1.97, }, { name: "CA State Income Tax", employer: false, amount: 1.97, }, { name: "CA State Income Tax", employer: false, amount: 1.97, }, ], deductions: [ { name: "Company Car", amount: 10.97, }, { name: "Company Car", amount: 10.97, }, ], benefits: [ { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, ], }, { employeeId: "12345", netPay: 2199.93, grossPay: 3000, taxes: [ { name: "CA State Income Tax", employer: false, amount: 1.97, }, ], deductions: [ { name: "Company Car", amount: 10.97, }, ], benefits: [ { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, { name: "Health Insurance", employeeDeduction: 142.94, employerContribution: 141.14, }, ], }, ], }, }); });