Skip to content

Commit 1997e22

Browse files
committed
Update test because there seems to be a change in error message depending on broker version
1 parent 0b5e022 commit 1997e22

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

test/promisified/admin/create_topics.spec.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const {
55
createAdmin,
66
sleep,
77
} = require('../testhelpers');
8-
const { KafkaJSAggregateError, KafkaJSCreateTopicError } = require('../../../lib').KafkaJS;
8+
const { KafkaJSAggregateError, KafkaJSCreateTopicError, ErrorCodes } = require('../../../lib').KafkaJS;
99

1010
describe('Admin > createTopics', () => {
1111
let topicNames, admin;
@@ -90,11 +90,11 @@ describe('Admin > createTopics', () => {
9090

9191
const replicationErr = storedErr.errors.find(e => e.topic === topicNames[0] + '-invalid');
9292
expect(replicationErr).toBeInstanceOf(KafkaJSCreateTopicError);
93-
expect(replicationErr.message).toMatch(/The target replication factor/);
93+
expect(replicationErr.code).toEqual(ErrorCodes.ERR_INVALID_REPLICATION_FACTOR);
9494

9595
const partitionsErr = storedErr.errors.find(e => e.topic === topicNames[1]+ '-invalid');
9696
expect(partitionsErr).toBeInstanceOf(KafkaJSCreateTopicError);
97-
expect(partitionsErr.message).toMatch(/Number of partitions was set to an invalid non-positive value/);
97+
expect(partitionsErr.code).toEqual(ErrorCodes.ERR_INVALID_PARTITIONS);
9898

9999
/* Despite errors the valid topic should still be created. */
100100
await expect(admin.listTopics()).resolves.toEqual(expect.arrayContaining([topicNames[0]]));

0 commit comments

Comments
 (0)