all files / express-stormpath/lib/helpers/ assert-org-mapped-to-app.js

87.5% Statements 7/8
75% Branches 3/4
100% Functions 4/4
87.5% Lines 7/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17    12× 12×       12× 24×   12×        
'use strict';
 
function assertOrganizationIsMappedToApplication(organization, application, cb) {
  application.getAccountStoreMappings(function (err, mappings) {
    Iif (err) {
      return cb(err);
    }
 
    mappings.some(function (mapping, next) {
      next(organization && mapping.accountStore.href === organization.href);
    }, function (hasMatch) {
      cb(null, hasMatch);
    });
  });
}
 
module.exports = assertOrganizationIsMappedToApplication;