@@ -4,6 +4,7 @@ var config = require('config');
44const API = require ( '../../api2.js' ) ;
55const Helpers = require ( '../../helpers2.js' ) ;
66const { API2Before, API2After } = require ( "../shared.js" ) ;
7+ const { post} = require ( '../../httpHandler.js' ) ;
78
89describe ( 'ItemsTests' , function ( ) {
910 this . timeout ( config . timeout * 2 ) ;
@@ -367,7 +368,7 @@ describe('ItemsTests', function () {
367368 } ) ,
368369 { "Content-Type" : "application/json" }
369370 ) ;
370- Helpers . assertStatusForObject ( response , 'failed' , 0 , 400 , "'itemType' property not provided" ) ;
371+ Helpers . assert400ForObject ( response , { message : "'itemType' property not provided" } ) ;
371372
372373 // contentType on non-attachment
373374 const json3 = { ...json } ;
@@ -380,7 +381,7 @@ describe('ItemsTests', function () {
380381 } ) ,
381382 { "Content-Type" : "application/json" }
382383 ) ;
383- Helpers . assertStatusForObject ( response , 'failed' , 0 , 400 , "'contentType' is valid only for attachment items" ) ;
384+ Helpers . assert400ForObject ( response , { message : "'contentType' is valid only for attachment items" } ) ;
384385 } ) ;
385386
386387 it ( 'testEditTopLevelNote' , async function ( ) {
@@ -486,7 +487,7 @@ describe('ItemsTests', function () {
486487 items : [ json ] ,
487488 } ) ,
488489 ) ;
489- Helpers . assertStatusForObject ( response , 'success' , 0 ) ;
490+ Helpers . assert200ForObject ( response ) ;
490491 const xml2 = await API . getItemXML ( json . itemKey ) ;
491492 const data2 = API . parseDataFromAtomEntry ( xml2 ) ;
492493 const json2 = JSON . parse ( data2 . content ) ;
@@ -660,7 +661,7 @@ describe('ItemsTests', function () {
660661 } ) ,
661662 { "Content-Type" : "application/json" }
662663 ) ;
663- Helpers . assertStatusForObject ( newResponse , 'failed' , 0 , 400 , "'invalidName' is not a valid linkMode" ) ;
664+ Helpers . assert400ForObject ( newResponse , { message : "'invalidName' is not a valid linkMode" } ) ;
664665
665666 // Missing linkMode
666667 delete json . linkMode ;
@@ -672,7 +673,7 @@ describe('ItemsTests', function () {
672673 } ) ,
673674 { "Content-Type" : "application/json" }
674675 ) ;
675- Helpers . assertStatusForObject ( missingResponse , 'failed' , 0 , 400 , "'linkMode' property not provided" ) ;
676+ Helpers . assert400ForObject ( missingResponse , { message : "'linkMode' property not provided" } ) ;
676677 } ) ;
677678 it ( 'testNewAttachmentItemMD5OnLinkedURL' , async function ( ) {
678679 const newItemData = await testNewEmptyBookItem ( ) ;
@@ -691,7 +692,7 @@ describe('ItemsTests', function () {
691692 } ) ,
692693 { "Content-Type" : "application/json" }
693694 ) ;
694- Helpers . assertStatusForObject ( postResponse , 'failed' , 0 , 400 , "'md5' is valid only for imported and embedded-image attachments" ) ;
695+ Helpers . assert400ForObject ( postResponse , { message : "'md5' is valid only for imported and embedded-image attachments" } ) ;
695696 } ) ;
696697 it ( 'testNewAttachmentItemModTimeOnLinkedURL' , async function ( ) {
697698 const newItemData = await testNewEmptyBookItem ( ) ;
@@ -710,7 +711,7 @@ describe('ItemsTests', function () {
710711 } ) ,
711712 { "Content-Type" : "application/json" }
712713 ) ;
713- Helpers . assertStatusForObject ( postResponse , 'failed' , 0 , 400 , "'mtime' is valid only for imported and embedded-image attachments" ) ;
714+ Helpers . assert400ForObject ( postResponse , { message : "'mtime' is valid only for imported and embedded-image attachments" } ) ;
714715 } ) ;
715716 it ( 'testMappedCreatorTypes' , async function ( ) {
716717 const json = {
@@ -743,8 +744,8 @@ describe('ItemsTests', function () {
743744 JSON . stringify ( json )
744745 ) ;
745746 // 'author' gets mapped automatically, others dont
746- Helpers . assertStatusForObject ( response , 'failed' , 1 , 400 ) ;
747- Helpers . assertStatusForObject ( response , 'success' , 0 ) ;
747+ Helpers . assert400ForObject ( response , { index : 1 } ) ;
748+ Helpers . assert200ForObject ( response ) ;
748749 } ) ;
749750
750751 it ( 'testNumChildren' , async function ( ) {
0 commit comments