1- import {
2- CONFIG_FOR_INTEGRATION ,
3- FILE_LOCATION ,
4- FILE_LOCATION_4X6 ,
5- FILE_LOCATION_6X18 ,
6- } from "./testFixtures" ;
1+ import { CONFIG_FOR_INTEGRATION , FILE_LOCATION } from "./testFixtures" ;
72import { BuckslipsApi } from "../api/buckslips-api" ;
8- import {
9- Buckslip ,
10- BuckslipEditable ,
11- BuckslipEditableSizeEnum ,
12- } from "../models" ;
13- import FormData from "form-data" ;
14- import fs from "fs" ;
15- import { create } from "domain" ;
3+ import { BuckslipEditable , BuckslipEditableSizeEnum } from "../models" ;
164
175describe ( "BuckSlipsApi" , ( ) => {
186 it ( "Buckslips API can be instantiated" , ( ) => {
@@ -51,41 +39,29 @@ describe("BuckSlipsApi", () => {
5139 it ( "creates, updates, and gets a buckslip" , async ( ) => {
5240 const buckslipsApi = new BuckslipsApi ( CONFIG_FOR_INTEGRATION ) ;
5341
54- try {
55- // Create buckslip with proper file references
56- const createdBe = await buckslipsApi . create ( createBe ) ;
57- expect ( createdBe . id ) . toBeDefined ( ) ;
58- expect ( createdBe . description ) . toEqual ( createBe . description ) ;
42+ // Create buckslip with proper file references
43+ const createdBe = await buckslipsApi . create ( createBe ) ;
44+ expect ( createdBe . id ) . toBeDefined ( ) ;
45+ expect ( createdBe . description ) . toEqual ( createBe . description ) ;
5946
60- // Get
61- const retrievedBe = await buckslipsApi . get ( createdBe . id as string ) ;
62- expect ( retrievedBe ) . toEqual (
63- expect . objectContaining ( {
64- id : createdBe . id ,
65- } )
66- ) ;
47+ // Get
48+ const retrievedBe = await buckslipsApi . get ( createdBe . id as string ) ;
49+ expect ( retrievedBe ) . toEqual (
50+ expect . objectContaining ( {
51+ id : createdBe . id ,
52+ } )
53+ ) ;
6754
68- // Update
69- const updates = new BuckslipEditable ( {
70- description : "updated buckslip" ,
71- } ) ;
72- const updatedBe = await buckslipsApi . update (
73- retrievedBe . id as string ,
74- updates
75- ) ;
76- expect ( updatedBe ) . toBeDefined ( ) ;
77- expect ( updatedBe . description ) . toEqual ( "updated buckslip" ) ;
78- } catch ( error ) {
79- // If creation fails due to API requirements, just test the API structure
80- expect ( buckslipsApi ) . toEqual (
81- expect . objectContaining ( {
82- create : expect . any ( Function ) ,
83- get : expect . any ( Function ) ,
84- update : expect . any ( Function ) ,
85- delete : expect . any ( Function ) ,
86- } )
87- ) ;
88- }
55+ // Update
56+ const updates = new BuckslipEditable ( {
57+ description : "updated buckslip" ,
58+ } ) ;
59+ const updatedBe = await buckslipsApi . update (
60+ retrievedBe . id as string ,
61+ updates
62+ ) ;
63+ expect ( updatedBe ) . toBeDefined ( ) ;
64+ expect ( updatedBe . description ) . toEqual ( "updated buckslip" ) ;
8965 } ) ;
9066 } ) ;
9167
@@ -100,20 +76,10 @@ describe("BuckSlipsApi", () => {
10076 } ) ;
10177
10278 it ( "lists buckslips" , async ( ) => {
103- try {
104- const response = await new BuckslipsApi ( CONFIG_FOR_INTEGRATION ) . List ( ) ;
105- expect ( response . data ) . toBeDefined ( ) ;
106- // Don't require data to exist, just verify the API works
107- expect ( Array . isArray ( response . data ) ) . toBeTruthy ( ) ;
108- } catch ( error ) {
109- // If listing fails due to API requirements in CI, just verify the API structure exists
110- const buckslipsApi = new BuckslipsApi ( CONFIG_FOR_INTEGRATION ) ;
111- expect ( buckslipsApi ) . toEqual (
112- expect . objectContaining ( {
113- List : expect . any ( Function ) ,
114- } )
115- ) ;
116- }
79+ const response = await new BuckslipsApi ( CONFIG_FOR_INTEGRATION ) . List ( ) ;
80+ expect ( response . data ) . toBeDefined ( ) ;
81+ // Don't require data to exist, just verify the API works
82+ expect ( Array . isArray ( response . data ) ) . toBeTruthy ( ) ;
11783 } ) ;
11884 } ) ;
11985} ) ;
0 commit comments