All files / src/helpers hash-password.js

85.71% Statements 6/7
50% Branches 1/2
100% Functions 1/1
100% Lines 6/6

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 161x   1x     146x 146x           146x 146x    
const auth = require('@feathersjs/authentication-local').hooks;
 
module.exports = hashPassword;
 
async function hashPassword (app, password, field) {
  Iif (!field) throw new Error('Field is missing');
  const context = {
    type: 'before',
    data: { [field]: password },
    params: { provider: null },
    app
  };
  const newContext = await auth.hashPassword(field)(context);
  return newContext.data[field];
}