File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change 5
5
createAdmin,
6
6
sleep,
7
7
} = require ( '../testhelpers' ) ;
8
- const { KafkaJSAggregateError, KafkaJSCreateTopicError } = require ( '../../../lib' ) . KafkaJS ;
8
+ const { KafkaJSAggregateError, KafkaJSCreateTopicError, ErrorCodes } = require ( '../../../lib' ) . KafkaJS ;
9
9
10
10
describe ( 'Admin > createTopics' , ( ) => {
11
11
let topicNames , admin ;
@@ -90,11 +90,11 @@ describe('Admin > createTopics', () => {
90
90
91
91
const replicationErr = storedErr . errors . find ( e => e . topic === topicNames [ 0 ] + '-invalid' ) ;
92
92
expect ( replicationErr ) . toBeInstanceOf ( KafkaJSCreateTopicError ) ;
93
- expect ( replicationErr . message ) . toMatch ( / T h e t a r g e t r e p l i c a t i o n f a c t o r / ) ;
93
+ expect ( replicationErr . code ) . toEqual ( ErrorCodes . ERR_INVALID_REPLICATION_FACTOR ) ;
94
94
95
95
const partitionsErr = storedErr . errors . find ( e => e . topic === topicNames [ 1 ] + '-invalid' ) ;
96
96
expect ( partitionsErr ) . toBeInstanceOf ( KafkaJSCreateTopicError ) ;
97
- expect ( partitionsErr . message ) . toMatch ( / N u m b e r o f p a r t i t i o n s w a s s e t t o a n i n v a l i d n o n - p o s i t i v e v a l u e / ) ;
97
+ expect ( partitionsErr . code ) . toEqual ( ErrorCodes . ERR_INVALID_PARTITIONS ) ;
98
98
99
99
/* Despite errors the valid topic should still be created. */
100
100
await expect ( admin . listTopics ( ) ) . resolves . toEqual ( expect . arrayContaining ( [ topicNames [ 0 ] ] ) ) ;
You can’t perform that action at this time.
0 commit comments