@@ -2,10 +2,11 @@ import assert from 'node:assert';
22import { after , describe , it } from 'node:test' ;
33import { releaseAll } from '@cityssm/mssql-multi-pool' ;
44import Debug from 'debug' ;
5- import { DEBUG_ENABLE_NAMESPACES } from '../debug.config.js' ;
5+ import { DEBUG_ENABLE_NAMESPACES , DEBUG_NAMESPACE } from '../debug.config.js' ;
66import { DynamicsGP } from '../index.js' ;
77import { config } from './config.js' ;
88Debug . enable ( DEBUG_ENABLE_NAMESPACES ) ;
9+ const debug = Debug ( `${ DEBUG_NAMESPACE } :test:gp` ) ;
910await describe ( 'dynamics-gp' , async ( ) => {
1011 const gp = new DynamicsGP ( config . mssql ) ;
1112 const gpMisconfigured = new DynamicsGP ( {
@@ -107,9 +108,10 @@ await describe('dynamics-gp', async () => {
107108 await it ( 'Retrieves an Item' , async ( ) => {
108109 await gp . getItemByItemNumber ( config . itemNumber ) ;
109110 const item = await gp . getItemByItemNumber ( config . itemNumber ) ;
110- console . log ( item ) ;
111+ debug ( item ) ;
111112 assert . ok ( item !== undefined ) ;
112113 assert . strictEqual ( config . itemNumber , item . itemNumber ) ;
114+ assert . ok ( Object . hasOwn ( item , 'itemClassCode' ) ) ;
113115 } ) ;
114116 await it ( 'Returns undefined when item number is not found' , async ( ) => {
115117 const item = await gp . getItemByItemNumber ( config . itemNumberNotFound ) ;
@@ -130,6 +132,7 @@ await describe('dynamics-gp', async () => {
130132 await it ( 'Retrieves Items' , async ( ) => {
131133 const items = await gp . getItemsByLocationCodes ( config . locationCodes ) ;
132134 assert . ok ( items . length > 0 ) ;
135+ assert . ok ( Object . hasOwn ( items [ 0 ] , 'itemClassCode' ) ) ;
133136 } ) ;
134137 await it ( 'Throws an error when SQL is misconfigured' , async ( ) => {
135138 try {
@@ -161,7 +164,7 @@ await describe('dynamics-gp', async () => {
161164 vendorNameDoesNotContain : config . vendorNameDoesNotContain ,
162165 lastPurchaseDateMin : new Date ( '2024-01-01' )
163166 } ) ;
164- console . log ( vendors ) ;
167+ debug ( vendors ) ;
165168 assert . ok ( vendors . length > 0 ) ;
166169 } ) ;
167170 await it ( 'Throws an error when SQL is misconfigured' , async ( ) => {
0 commit comments