1+ import MiNotFoundError from "@internal/datastore/src/errors/mi-not-found-error" ;
12import { IncomingMI } from "../../contracts/mi" ;
23import { getMI , postMI } from "../mi-operations" ;
3- import MiNotFoundError from "@internal/datastore/src/errors/mi-not-found-error" ;
4-
54
65describe ( "postMI function" , ( ) => {
76 const incomingMi : IncomingMI = {
@@ -41,7 +40,6 @@ describe("postMI function", () => {
4140} ) ;
4241
4342describe ( "getMI function" , ( ) => {
44- it ( "retrieves the MI from the repository" , async ( ) => {
4543 const incomingMi : IncomingMI = {
4644 lineItem : "envelope-business-standard" ,
4745 timestamp : "2023-11-17T14:27:51.413Z" ,
@@ -51,6 +49,7 @@ describe("getMI function", () => {
5149 stockRemaining : 20_000 ,
5250 supplierId : "supplier1" ,
5351 } ;
52+ it ( "retrieves the MI from the repository" , async ( ) => {
5453 const persistedMi = { id : "id1" , ...incomingMi } ;
5554
5655 const mockRepo = {
@@ -82,18 +81,18 @@ describe("getMI function", () => {
8281 . mockRejectedValue ( new MiNotFoundError ( "supplier1" , "miId1" ) ) ,
8382 } ;
8483
85- await expect (
86- getMI ( "miId1" , "supplier1" , mockRepo as any ) ,
87- ) . rejects . toThrow ( "No resource found with that ID" ) ;
84+ await expect ( getMI ( "miId1" , "supplier1" , mockRepo as any ) ) . rejects . toThrow (
85+ "No resource found with that ID" ,
86+ ) ;
8887 } ) ;
8988
9089 it ( "should throw unexpected error" , async ( ) => {
9190 const mockRepo = {
9291 getMI : jest . fn ( ) . mockRejectedValue ( new Error ( "unexpected error" ) ) ,
9392 } ;
9493
95- await expect (
96- getMI ( "miId1" , "supplier1" , mockRepo as any ) ,
97- ) . rejects . toThrow ( "unexpected error" ) ;
94+ await expect ( getMI ( "miId1" , "supplier1" , mockRepo as any ) ) . rejects . toThrow (
95+ "unexpected error" ,
96+ ) ;
9897 } ) ;
9998} ) ;
0 commit comments