11import test from 'ava'
22import { each } from 'test-each'
33
4- import { TestError , testError } from './helpers/main.js'
4+ import { BaseError , baseError } from './helpers/main.js'
55
66each (
77 [
2121 ] ,
2222 ( { title } , [ propName , propValue ] ) => {
2323 test ( `Valid options are kept | ${ title } ` , ( t ) => {
24- const httpResponse = testError . httpResponse ( { [ propName ] : propValue } )
24+ const httpResponse = baseError . httpResponse ( { [ propName ] : propValue } )
2525 t . deepEqual ( httpResponse [ propName ] , propValue )
2626 } )
2727 } ,
@@ -37,28 +37,28 @@ each(
3737 ] ,
3838 ( { title } , http ) => {
3939 test ( `Assign default options | ${ title } ` , ( t ) => {
40- const { name, message, stack } = testError
41- const httpResponse = testError . httpResponse ( http )
40+ const { name, message, stack } = baseError
41+ const httpResponse = baseError . httpResponse ( http )
4242 t . deepEqual ( httpResponse , { title : name , detail : message , stack } )
4343 } )
4444 } ,
4545)
4646
4747test ( 'Assign default extra' , ( t ) => {
4848 const props = { prop : true }
49- t . deepEqual ( new TestError ( 'test' , { props } ) . httpResponse ( ) . extra , props )
49+ t . deepEqual ( new BaseError ( 'test' , { props } ) . httpResponse ( ) . extra , props )
5050} )
5151
5252test ( 'Keep extra JSON-safe' , ( t ) => {
53- t . deepEqual ( testError . httpResponse ( { extra : { one : true , two : 0n } } ) . extra , {
53+ t . deepEqual ( baseError . httpResponse ( { extra : { one : true , two : 0n } } ) . extra , {
5454 one : true ,
5555 } )
5656} )
5757
5858test ( 'Keep object keys order' , ( t ) => {
5959 t . deepEqual (
6060 Object . keys (
61- testError . httpResponse ( {
61+ baseError . httpResponse ( {
6262 extra : { } ,
6363 stack : '' ,
6464 instance : '' ,
0 commit comments