import * as t from 'io-ts' ; import { CurrenciesEnum , Discojs , InventorySortEnum , InventoryStatusesEnum , SortOrdersEnum } from '.' ; import { InventoryResponseIO , MarketplaceStatisticsResponseIO , OrdersResponseIO } from '../models/api' ; import { FeeIO , ListingIO } from '../models/marketplace' ; declare const client ; const pagination = { page : 1 , perPage : 1 } ; describe ( 'Marketplace' , ( ) => { describe ( 'Inventory' , ( ) => { const username = 'Kozuch438' ; it ( 'getInventoryForUser' , async ( ) => { const apiResponse = await client . getInventoryForUser ( username ) ; expect ( t . exact ( InventoryResponseIO ) . is ( apiResponse ) ) . toBeTruthy ( ) ; } ) ; it ( 'getInventoryForUser - with status' , async ( ) => { const apiResponse = await client . getInventoryForUser ( username , InventoryStatusesEnum . FOR_SALE ) ; expect ( t . exact ( InventoryResponseIO ) . is ( apiResponse ) ) . toBeTruthy ( ) ; } ) ; it ( 'getInventoryForUser - with sort' , async ( ) => { const by = InventorySortEnum . LISTED ; const firstApiResponse = await client . getInventoryForUser ( username , undefined , { by , order : SortOrdersEnum . ASC } ) ; expect ( firstApiResponse . listings . length ) . toBeGreaterThanOrEqual ( 2 ) ; const firstId = firstApiResponse . listings [ 0 ] . id ; const secondApiResponse = await client . getInventoryForUser ( username , undefined , { by , order : SortOrdersEnum . DESC , } ) ; const secondId = secondApiResponse . listings [ 0 ] . id ; expect ( firstId ) . not . toEqual ( secondId ) ; const apiResponse = await client . getInventoryForUser ( username , undefined ) ; expect ( t . exact ( InventoryResponseIO ) . is ( apiResponse ) ) . toBeTruthy ( ) ; } ) ; it ( 'getInventoryForUser - with pagination' , async ( ) => { const apiResponse = await client . getInventoryForUser ( username , undefined , undefined , pagination ) ; expect ( apiResponse . pagination ) . toHaveProperty ( 'page' , pagination . page ) ; expect ( apiResponse . pagination ) . toHaveProperty ( 'per_page' , pagination . perPage ) ; } ) ; it ( 'getInventory' , async ( ) => { const apiResponse = await client . getInventory ( ) ; expect ( t . exact ( InventoryResponseIO ) . is ( apiResponse ) ) . toBeTruthy ( ) ; } ) ; } ) ; describe ( 'Listing' , ( ) => { it ( 'getListing' , async ( ) => { const listingId = 7440 ; const apiResponse = await client . getListing ( listingId ) ; expect ( t . exact ( ListingIO ) . is ( apiResponse ) ) . toBeTruthy ( ) ; } ) ; it ( 'getListing - with currency' , async ( ) => { const listingId = 7440 ; const apiResponse = await client . getListing ( listingId , CurrenciesEnum . SEK ) ; expect ( t . exact ( ListingIO ) . is ( apiResponse ) ) . toBeTruthy ( ) ; } ) ; } ) ; describe ( 'Order' , ( ) => { it ( 'listOrders' , async ( ) => { const apiResponse = await client . listOrders ( ) ; expect ( t . exact ( OrdersResponseIO ) . is ( apiResponse ) ) . toBeTruthy ( ) ; } ) ; } ) ; describe ( 'Fee' , ( ) => { const price = 42 ; } ) ; describe ( 'Price suggestions' , ( ) => { } ) ; describe ( 'Statistics' , ( ) => { it ( 'getMarketplaceStatistics' , async ( ) => { const releaseId = 7781525 ; const apiResponse = await client . getMarketplaceStatistics ( releaseId ) ; expect ( t . exact ( MarketplaceStatisticsResponseIO ) . is ( apiResponse ) ) . toBeTruthy ( ) ; } ) ; } ) ; } ) ;