@@ -48,16 +48,12 @@ describe('defineStack — an `external` binding on a managed datasource the stac
4848 it . each ( [
4949 [ "`schemaMode: 'managed'`" , { schemaMode : 'managed' } ] ,
5050 [ 'no `schemaMode` (managed by default)' , { } ] ,
51- ] ) ( '%s: STACK_CROSS_REFERENCE_INVALID, 422, one finding naming the object, the datasource and both fixes ' , ( _label , mode ) => {
51+ ] ) ( '%s: STACK_CROSS_REFERENCE_INVALID, 422, one finding naming the object and the datasource ' , ( _label , mode ) => {
5252 const err = refusalOf ( { datasources : [ warehouse ( mode ) ] , objects : [ order ( { datasource : 'warehouse' } ) ] } ) ;
5353 expect ( err ?. code ) . toBe ( 'STACK_CROSS_REFERENCE_INVALID' ) ;
5454 expect ( err ?. status ) . toBe ( 422 ) ;
55- expect ( err ?. message ) . toMatch ( / ^ d e f i n e S t a c k c r o s s - r e f e r e n c e v a l i d a t i o n f a i l e d \( 1 i s s u e \) : / ) ;
5655 expect ( err ?. issues ) . toHaveLength ( 1 ) ;
57- const finding = String ( err ! . issues ! [ 0 ] ) ;
58- expect ( finding ) . toMatch ( / ^ O b j e c t ' w h _ o r d e r ' d e c l a r e s ` e x t e r n a l ` o n d a t a s o u r c e ' w a r e h o u s e ' , w h o s e ` s c h e m a M o d e ` i s ' m a n a g e d ' / ) ;
59- expect ( finding ) . toContain ( "ADR-0015 §4.2 allows `external` only on a datasource whose `schemaMode` is not 'managed'." ) ;
60- expect ( finding ) . toContain ( "declare it with `schemaMode: 'external'` (or 'validate-only')" ) ;
56+ expect ( String ( err ! . issues ! [ 0 ] ) ) . toMatch ( / ^ O b j e c t ' w h _ o r d e r ' d e c l a r e s ` e x t e r n a l ` o n d a t a s o u r c e ' w a r e h o u s e ' , w h o s e ` s c h e m a M o d e ` i s ' m a n a g e d ' / ) ;
6157 } ) ;
6258
6359 it ( 'one finding per bound object; an unbound object on the same datasource is not one' , ( ) => {
@@ -101,7 +97,6 @@ describe('defineStack — an `external` binding on the primary datasource', () =
10197 expect ( err ?. issues ) . toEqual ( [
10298 expect . objectContaining ( { code : 'custom' , path : [ 'objects' , 0 , 'external' ] } ) ,
10399 ] ) ;
104- expect ( err ?. message ) . toContain ( "objects.0.external: Object 'wh_order' declares `external`, but its `datasource` is 'default'" ) ;
105100 } ) ;
106101
107102 it ( 'a package `defaultDatasource` naming an external datasource does not make the object federated' , ( ) => {
@@ -111,6 +106,9 @@ describe('defineStack — an `external` binding on the primary datasource', () =
111106 objects : [ order ( ) ] ,
112107 } ) ;
113108 expect ( err ?. code ) . toBe ( 'STACK_SCHEMA_INVALID' ) ;
114- expect ( err ?. message ) . toContain ( 'A package `defaultDatasource` or a `datasourceMapping` rule does not count' ) ;
109+ expect ( err ?. status ) . toBe ( 422 ) ;
110+ expect ( err ?. issues ) . toEqual ( [
111+ expect . objectContaining ( { code : 'custom' , path : [ 'objects' , 0 , 'external' ] } ) ,
112+ ] ) ;
115113 } ) ;
116114} ) ;
0 commit comments