All files / helpers/wrappers seeders.js

100% Statements 7/7
80% Branches 4/5
66.66% Functions 2/3
100% Lines 7/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20    1x 4x 4x 3x     3x 1x     2x              
/* eslint-disable no-console */
 
export const wrapperUp = async (queryInterface, callback = () => {}) => {
  try {
    await queryInterface.sequelize.transaction(async (transaction) => {
      await callback(transaction);
    });
  } catch (e) {
    if (e.parent && e.parent.code === 'ER_DUP_ENTRY') {
      return;
    }
 
    throw e;
  }
};
 
export default {
  wrapperUp,
};