/* * 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("Timeoffrequests Hris Time Off Requests All", async () => { const testHttpClient = createTestHTTPClient("hris.timeOffRequestsAll"); 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.timeOffRequests.list({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", filter: { startDate: "2022-04-08", endDate: "2022-04-21", updatedSince: "2020-09-30T07:43:32.000Z", employeeId: "1234", timeOffRequestStatus: "approved", companyId: "1234", }, passThrough: { "search": "San Francisco", }, fields: "id,updated_at", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getTimeOffRequestsResponse).toBeDefined(); expect(result.getTimeOffRequestsResponse).toEqual({ statusCode: 200, status: "OK", service: "bamboohr", resource: "time-off-requests", operation: "all", data: [ { id: "12345", employeeId: "12345", policyId: "12345", status: "approved", description: "Enjoying some sun.", startDate: "2022-04-01", endDate: "2022-04-01", requestDate: "2022-03-21", requestType: "vacation", approvalDate: "2022-03-21", units: "hours", amount: 3.5, dayPart: "morning", notes: { employee: "Relaxing on the beach for a few hours.", manager: "Enjoy!", }, 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", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], policyType: "sick", }, { id: "12345", employeeId: "12345", policyId: "12345", status: "approved", description: "Enjoying some sun.", startDate: "2022-04-01", endDate: "2022-04-01", requestDate: "2022-03-21", requestType: "vacation", approvalDate: "2022-03-21", units: "hours", amount: 3.5, dayPart: "morning", notes: { employee: "Relaxing on the beach for a few hours.", manager: "Enjoy!", }, 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", }, }, }, ], }, ], policyType: "sick", }, { id: "12345", employeeId: "12345", policyId: "12345", status: "approved", description: "Enjoying some sun.", startDate: "2022-04-01", endDate: "2022-04-01", requestDate: "2022-03-21", requestType: "vacation", approvalDate: "2022-03-21", units: "hours", amount: 3.5, dayPart: "morning", notes: { employee: "Relaxing on the beach for a few hours.", manager: "Enjoy!", }, 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", }, }, }, ], }, ], policyType: "sick", }, ], 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("Timeoffrequests Hris Time Off Requests Add", async () => { const testHttpClient = createTestHTTPClient("hris.timeOffRequestsAdd"); 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.timeOffRequests.create({ consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", timeOffRequest: { employeeId: "12345", policyId: "12345", status: "approved", description: "Enjoying some sun.", startDate: "2022-04-01", endDate: "2022-04-01", requestDate: "2022-03-21", requestType: "vacation", approvalDate: "2022-03-21", units: "hours", amount: 3.5, dayPart: "morning", notes: { employee: "Relaxing on the beach for a few hours.", manager: "Enjoy!", }, 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", }, }, }, ], }, ], policyType: "sick", }, }); expect(result.httpMeta.response.status).toBe(201); expect(result.createTimeOffRequestResponse).toBeDefined(); expect(result.createTimeOffRequestResponse).toEqual({ statusCode: 200, status: "OK", service: "bamboohr", resource: "time-off-requests", operation: "add", data: { id: "12345", }, }); }); test("Timeoffrequests Hris Time Off Requests One", async () => { const testHttpClient = createTestHTTPClient("hris.timeOffRequestsOne"); 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.timeOffRequests.get({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", fields: "id,updated_at", employeeId: "", }); expect(result.httpMeta.response.status).toBe(200); expect(result.getTimeOffRequestResponse).toBeDefined(); expect(result.getTimeOffRequestResponse).toEqual({ statusCode: 200, status: "OK", service: "bamboohr", resource: "time-off-requests", operation: "one", data: { id: "12345", employeeId: "12345", policyId: "12345", status: "approved", description: "Enjoying some sun.", startDate: "2022-04-01", endDate: "2022-04-01", requestDate: "2022-03-21", requestType: "vacation", approvalDate: "2022-03-21", units: "hours", amount: 3.5, dayPart: "morning", notes: { employee: "Relaxing on the beach for a few hours.", manager: "Enjoy!", }, 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", }, }, }, ], }, { serviceId: "", extendPaths: [ { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, { path: "$.nested.property", value: { "TaxClassificationRef": { "value": "EUC-99990201-V1-00020000", }, }, }, ], }, ], policyType: "sick", }, }); }); test("Timeoffrequests Hris Time Off Requests Update", async () => { const testHttpClient = createTestHTTPClient("hris.timeOffRequestsUpdate"); 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.timeOffRequests.update({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", employeeId: "", timeOffRequest: { employeeId: "12345", policyId: "12345", status: "approved", description: "Enjoying some sun.", startDate: "2022-04-01", endDate: "2022-04-01", requestDate: "2022-03-21", requestType: "vacation", approvalDate: "2022-03-21", units: "hours", amount: 3.5, dayPart: "morning", notes: { employee: "Relaxing on the beach for a few hours.", manager: "Enjoy!", }, 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", }, }, }, ], }, { 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", }, }, }, ], }, ], policyType: "sick", }, }); expect(result.httpMeta.response.status).toBe(200); expect(result.updateTimeOffRequestResponse).toBeDefined(); expect(result.updateTimeOffRequestResponse).toEqual({ statusCode: 200, status: "OK", service: "bamboohr", resource: "time-off-requests", operation: "update", data: { id: "12345", }, }); }); test("Timeoffrequests Hris Time Off Requests Delete", async () => { const testHttpClient = createTestHTTPClient("hris.timeOffRequestsDelete"); 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.timeOffRequests.delete({ id: "", consumerId: "test-consumer", appId: "dSBdXd2H6Mqwfg0atXHXYcysLJE9qyn1VwBtXHX", serviceId: "salesforce", employeeId: "", }); expect(result.httpMeta.response.status).toBe(200); expect(result.deleteTimeOffRequestResponse).toBeDefined(); expect(result.deleteTimeOffRequestResponse).toEqual({ statusCode: 200, status: "OK", service: "bamboohr", resource: "time-off-requests", operation: "delete", data: { id: "12345", }, }); });