Skip to content

Commit

Permalink
linting and unit test fix in kafka-bridges
Browse files Browse the repository at this point in the history
  • Loading branch information
wagmarcel committed Nov 17, 2024
1 parent 6df62ae commit 027aaf7
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 8 deletions.
6 changes: 0 additions & 6 deletions KafkaBridge/lib/debeziumBridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -229,9 +229,6 @@ module.exports = function DebeziumBridge (conf) {
Object.keys(beforeAttrs).forEach(key => {
if (afterAttrs[key] === undefined || afterAttrs[key] === null || !Array.isArray(afterAttrs[key]) || afterAttrs[key].length === 0) {
const obj = beforeAttrs[key].reduce((accum, element) => {
//const obj = {};
//obj.id = element.id;
//obj.index = element.index;
delete element.type;
accum.push(element);
return accum;
Expand Down Expand Up @@ -262,9 +259,6 @@ module.exports = function DebeziumBridge (conf) {
const delementArray = [];
if (beforeAttrs[key] !== undefined && beforeAttrs[key].length > afterAttrs[key].length) {
for (let i = afterAttrs[key].length; i < beforeAttrs[key].length; i++) {
//const delement = {};
//delement.id = beforeAttrs[key][i].id;
//delement.index = i;
delete beforeAttrs[key][i].type;
delementArray.push(beforeAttrs[key][i]);
}
Expand Down
4 changes: 2 additions & 2 deletions KafkaBridge/test/testLibDebeziumBridge.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ describe('Test diffAttributes', function () {
const debeziumBridge = new ToTest(config);
const result = debeziumBridge.diffAttributes(beforeAttrs, afterAttrs);
assert.deepEqual(result.updatedAttrs, {});
assert.deepEqual(result.deletedAttrs, { attr2: [{ id: 'id2', index: 0 }] });
assert.deepEqual(result.deletedAttrs, { attr2: [{ id: 'id2', index: 0, value: 'value3' }] });
revert();
});
it('Should delete higher index value and update changed value', async function () {
Expand Down Expand Up @@ -161,7 +161,7 @@ describe('Test diffAttributes', function () {
const debeziumBridge = new ToTest(config);
const result = debeziumBridge.diffAttributes(beforeAttrs, afterAttrs, 'observedAt');
assert.deepEqual(result.updatedAttrs, { attr1: [{ id: 'id3', value: 'value4', index: 0 }] });
assert.deepEqual(result.deletedAttrs, { attr2: [{ id: 'id2', index: 0 }], attr1: [{ id: 'id', index: 1 }] });
assert.deepEqual(result.deletedAttrs, { attr2: [{ id: 'id2', index: 0, value: 'value3' }], attr1: [{ id: 'id', index: 1, value: 'value2' }] });
revert();
});
});
Expand Down

0 comments on commit 027aaf7

Please sign in to comment.