+1
-1
@@ -1,2 +0,2 @@ | ||
| image: node:7 | ||
| image: node:8 | ||
@@ -3,0 +3,0 @@ before_script: |
+22
-11
@@ -28,4 +28,10 @@ 'use strict'; | ||
| class Authsome { | ||
| constructor(config, context) { | ||
| var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
| function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | ||
| var Authsome = function () { | ||
| function Authsome(config, context) { | ||
| _classCallCheck(this, Authsome); | ||
| if (config) { | ||
@@ -44,13 +50,18 @@ this.mode = config.mode; | ||
| can(user, operation, object) { | ||
| if (this.mode === 'freefornone') { | ||
| return Promise.resolve(false); | ||
| } else { | ||
| let result = this.mode(user, operation, object, this.context); | ||
| let isPromise = typeof result.then === 'function'; | ||
| return isPromise ? result : Promise.resolve(result); | ||
| _createClass(Authsome, [{ | ||
| key: 'can', | ||
| value: function can(user, operation, object) { | ||
| if (this.mode === 'freefornone') { | ||
| return Promise.resolve(false); | ||
| } else { | ||
| var result = this.mode(user, operation, object, this.context); | ||
| var isPromise = typeof result.then === 'function'; | ||
| return isPromise ? result : Promise.resolve(result); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| }]); | ||
| return Authsome; | ||
| }(); | ||
| module.exports = Authsome; |
+138
-77
@@ -0,1 +1,121 @@ | ||
| 'use strict'; | ||
| var blog = function () { | ||
| var _ref = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(userId, operation, object, context) { | ||
| var user, collection, fragment; | ||
| return regeneratorRuntime.wrap(function _callee$(_context) { | ||
| while (1) { | ||
| switch (_context.prev = _context.next) { | ||
| case 0: | ||
| if (userId) { | ||
| _context.next = 2; | ||
| break; | ||
| } | ||
| return _context.abrupt('return', unauthenticatedUser(operation, object)); | ||
| case 2: | ||
| _context.next = 4; | ||
| return context.models.User.find(userId); | ||
| case 4: | ||
| user = _context.sent; | ||
| if (!(user && user.admin === true)) { | ||
| _context.next = 7; | ||
| break; | ||
| } | ||
| return _context.abrupt('return', true); | ||
| case 7: | ||
| if (!(object.type === 'collection')) { | ||
| _context.next = 15; | ||
| break; | ||
| } | ||
| collection = object; | ||
| if (!isOwner(user, collection)) { | ||
| _context.next = 11; | ||
| break; | ||
| } | ||
| return _context.abrupt('return', true); | ||
| case 11: | ||
| if (!teamPermissions(user, operation, collection)) { | ||
| _context.next = 13; | ||
| break; | ||
| } | ||
| return _context.abrupt('return', true); | ||
| case 13: | ||
| _context.next = 27; | ||
| break; | ||
| case 15: | ||
| if (!(object.type === 'fragment')) { | ||
| _context.next = 25; | ||
| break; | ||
| } | ||
| fragment = object; | ||
| if (!isOwner(user, fragment)) { | ||
| _context.next = 19; | ||
| break; | ||
| } | ||
| return _context.abrupt('return', true); | ||
| case 19: | ||
| if (!teamPermissions(user, operation, fragment)) { | ||
| _context.next = 21; | ||
| break; | ||
| } | ||
| return _context.abrupt('return', true); | ||
| case 21: | ||
| if (!(Array.isArray(fragment.parents) && teamPermissions(user, operation, fragment.parents[0]))) { | ||
| _context.next = 23; | ||
| break; | ||
| } | ||
| return _context.abrupt('return', true); | ||
| case 23: | ||
| _context.next = 27; | ||
| break; | ||
| case 25: | ||
| if (!(object.type === 'user')) { | ||
| _context.next = 27; | ||
| break; | ||
| } | ||
| return _context.abrupt('return', user.id === object.id); | ||
| case 27: | ||
| return _context.abrupt('return', unauthenticatedUser(operation, object)); | ||
| case 28: | ||
| case 'end': | ||
| return _context.stop(); | ||
| } | ||
| } | ||
| }, _callee, this); | ||
| })); | ||
| return function blog(_x, _x2, _x3, _x4) { | ||
| return _ref.apply(this, arguments); | ||
| }; | ||
| }(); | ||
| function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } | ||
| var pick = require('lodash/pick'); | ||
| function isPublished(fragment) { | ||
@@ -10,7 +130,3 @@ return fragment.published; | ||
| for (const ownerId of object.owners) { | ||
| if (ownerId === user.id) { | ||
| return true; | ||
| } | ||
| } | ||
| return object.owners.includes(user.id); | ||
| } | ||
@@ -23,25 +139,14 @@ | ||
| for (const team of user.teams) { | ||
| if (team.teamType.permissions === 'POST' && team.object.id === object.id && operation === 'POST') { | ||
| return true; | ||
| } else if (team.teamType.permissions === 'PATCH' && team.object.id === object.id && operation === 'PATCH') { | ||
| return true; | ||
| } | ||
| } | ||
| return false; | ||
| return user.teams.some(function (team) { | ||
| return ['POST', 'PATCH'].includes(operation) && operation === team.teamType.permissions && team.object.id === object.id; | ||
| }); | ||
| } | ||
| function unauthenticatedUser(operation, object) { | ||
| // Public/unauthenticated users can GET /collections, filtered by 'published' | ||
| if (operation === 'GET' && object && object.path === '/collections') { | ||
| return { | ||
| filter: collection => collection.published | ||
| }; | ||
| } | ||
| // Public/unauthenticated users can GET /collections/:id/fragments, filtered by 'published' | ||
| if (operation === 'GET' && object && object.path === '/collections/:id/fragments') { | ||
| return { | ||
| filter: fragment => fragment.published | ||
| filter: function filter(fragments) { | ||
| return fragments.filter(isPublished); | ||
| } | ||
| }; | ||
@@ -52,15 +157,15 @@ } | ||
| if (operation === 'GET' && object && object.type === 'collection') { | ||
| if (object.published) { | ||
| return { | ||
| filter: (_, key) => ['id', 'title', 'owners'].includes(key) | ||
| }; | ||
| } | ||
| return { | ||
| filter: function filter(collection) { | ||
| return pick(collection, ['id', 'title', 'owners']); | ||
| } | ||
| }; | ||
| } | ||
| if (operation === 'GET' && object && object.type === 'fragment') { | ||
| if (object.published) { | ||
| return { | ||
| filter: (_, key) => ['id', 'title', 'source', 'presentation', 'owners'].includes(key) | ||
| }; | ||
| } | ||
| if (operation === 'GET' && object && object.type === 'fragment' && object.published) { | ||
| return { | ||
| filter: function filter(fragment) { | ||
| return pick(fragment, ['id', 'title', 'source', 'presentation', 'owners']); | ||
| } | ||
| }; | ||
| } | ||
@@ -71,46 +176,2 @@ | ||
| var blog = function (user, operation, object, context) { | ||
| // Admins can do anything | ||
| if (user && user.admin === true) return true; | ||
| if (!user) { | ||
| return unauthenticatedUser(operation, object); | ||
| } | ||
| let collection; | ||
| if (object.type === 'collection') { | ||
| collection = object; | ||
| if (isOwner(user, collection)) { | ||
| return true; | ||
| } | ||
| if (teamPermissions(user, operation, collection)) { | ||
| return true; | ||
| } | ||
| } else if (object.type === 'fragment') { | ||
| let fragment = object; | ||
| if (isPublished(fragment) && operation === 'GET') { | ||
| return true; | ||
| } | ||
| if (isOwner(user, fragment)) { | ||
| return true; | ||
| } | ||
| if (teamPermissions(user, operation, fragment)) { | ||
| return true; | ||
| } | ||
| if (Array.isArray(fragment.parents)) { | ||
| collection = fragment.parents[0]; | ||
| return teamPermissions(user, operation, collection); | ||
| } | ||
| } else if (object.type === 'user') { | ||
| return user.id === object.id; | ||
| } | ||
| return false; | ||
| }; | ||
| module.exports = blog; |
+105
-19
@@ -0,1 +1,3 @@ | ||
| 'use strict'; | ||
| function isAllowed(operation, permission) { | ||
@@ -31,13 +33,55 @@ if ((operation === 'read' || operation === 'update' || operation === 'delete') && permission === 'delete') { | ||
| for (const objectOwnerId of object.owners) { | ||
| if (objectOwnerId === user.id) { | ||
| return true; | ||
| var _iteratorNormalCompletion = true; | ||
| var _didIteratorError = false; | ||
| var _iteratorError = undefined; | ||
| try { | ||
| for (var _iterator = object.owners[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
| var objectOwnerId = _step.value; | ||
| if (objectOwnerId === user.id) { | ||
| return true; | ||
| } | ||
| } | ||
| } catch (err) { | ||
| _didIteratorError = true; | ||
| _iteratorError = err; | ||
| } finally { | ||
| try { | ||
| if (!_iteratorNormalCompletion && _iterator.return) { | ||
| _iterator.return(); | ||
| } | ||
| } finally { | ||
| if (_didIteratorError) { | ||
| throw _iteratorError; | ||
| } | ||
| } | ||
| } | ||
| if (Array.isArray(object.parents)) { | ||
| for (const parent of object.parents) { | ||
| if (parent.owners.includes(user)) { | ||
| return true; | ||
| var _iteratorNormalCompletion2 = true; | ||
| var _didIteratorError2 = false; | ||
| var _iteratorError2 = undefined; | ||
| try { | ||
| for (var _iterator2 = object.parents[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
| var parent = _step2.value; | ||
| if (parent.owners.includes(user)) { | ||
| return true; | ||
| } | ||
| } | ||
| } catch (err) { | ||
| _didIteratorError2 = true; | ||
| _iteratorError2 = err; | ||
| } finally { | ||
| try { | ||
| if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
| _iterator2.return(); | ||
| } | ||
| } finally { | ||
| if (_didIteratorError2) { | ||
| throw _iteratorError2; | ||
| } | ||
| } | ||
| } | ||
@@ -48,22 +92,64 @@ } | ||
| for (const team of user.teams) { | ||
| if (team.teamType.active) { | ||
| if (isAllowed(operation, team.teamType.permissions) && team.object === object && team.teamType.active(object)) { | ||
| return true; | ||
| var _iteratorNormalCompletion3 = true; | ||
| var _didIteratorError3 = false; | ||
| var _iteratorError3 = undefined; | ||
| try { | ||
| for (var _iterator3 = user.teams[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
| var team = _step3.value; | ||
| if (team.teamType.active) { | ||
| if (isAllowed(operation, team.teamType.permissions) && team.object === object && team.teamType.active(object)) { | ||
| return true; | ||
| } | ||
| } else { | ||
| if (isAllowed(operation, team.teamType.permissions) && team.object === object) { | ||
| return true; | ||
| } | ||
| } | ||
| } else { | ||
| if (isAllowed(operation, team.teamType.permissions) && team.object === object) { | ||
| return true; | ||
| } | ||
| // Users with permissions for parents of object | ||
| // This is only applicable in certain states | ||
| } catch (err) { | ||
| _didIteratorError3 = true; | ||
| _iteratorError3 = err; | ||
| } finally { | ||
| try { | ||
| if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
| _iterator3.return(); | ||
| } | ||
| } finally { | ||
| if (_didIteratorError3) { | ||
| throw _iteratorError3; | ||
| } | ||
| } | ||
| } | ||
| // Users with permissions for parents of object | ||
| // This is only applicable in certain states | ||
| if ((object.state === 'submitted' || object.state === undefined) && Array.isArray(object.parents)) { | ||
| var _iteratorNormalCompletion4 = true; | ||
| var _didIteratorError4 = false; | ||
| var _iteratorError4 = undefined; | ||
| if ((object.state === 'submitted' || object.state === undefined) && Array.isArray(object.parents)) { | ||
| for (const parent of object.parents) { | ||
| if (can(user, operation, parent)) { | ||
| return true; | ||
| try { | ||
| for (var _iterator4 = object.parents[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) { | ||
| var _parent = _step4.value; | ||
| if (can(user, operation, _parent)) { | ||
| return true; | ||
| } | ||
| } | ||
| } catch (err) { | ||
| _didIteratorError4 = true; | ||
| _iteratorError4 = err; | ||
| } finally { | ||
| try { | ||
| if (!_iteratorNormalCompletion4 && _iterator4.return) { | ||
| _iterator4.return(); | ||
| } | ||
| } finally { | ||
| if (_didIteratorError4) { | ||
| throw _iteratorError4; | ||
| } | ||
| } | ||
| } | ||
@@ -70,0 +156,0 @@ } |
+88
-22
@@ -1,12 +0,35 @@ | ||
| var noon = function (user, operation, object) { | ||
| let fragment = object; | ||
| let collection = fragment.parents[0]; | ||
| 'use strict'; | ||
| var noon = function noon(user, operation, object) { | ||
| var fragment = object; | ||
| var collection = fragment.parents[0]; | ||
| if (user.admin === true) return true; | ||
| if (operation === 'update' || operation === 'delete') { | ||
| for (const fragmentOwnerId of fragment.owners) { | ||
| if (fragmentOwnerId === user.id) { | ||
| return true; | ||
| var _iteratorNormalCompletion = true; | ||
| var _didIteratorError = false; | ||
| var _iteratorError = undefined; | ||
| try { | ||
| for (var _iterator = fragment.owners[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) { | ||
| var fragmentOwnerId = _step.value; | ||
| if (fragmentOwnerId === user.id) { | ||
| return true; | ||
| } | ||
| } | ||
| } catch (err) { | ||
| _didIteratorError = true; | ||
| _iteratorError = err; | ||
| } finally { | ||
| try { | ||
| if (!_iteratorNormalCompletion && _iterator.return) { | ||
| _iterator.return(); | ||
| } | ||
| } finally { | ||
| if (_didIteratorError) { | ||
| throw _iteratorError; | ||
| } | ||
| } | ||
| } | ||
@@ -16,28 +39,71 @@ } | ||
| if (operation === 'create') { | ||
| for (const collectionOwnerId of collection.owners) { | ||
| if (collectionOwnerId === user.id) { | ||
| return true; | ||
| var _iteratorNormalCompletion2 = true; | ||
| var _didIteratorError2 = false; | ||
| var _iteratorError2 = undefined; | ||
| try { | ||
| for (var _iterator2 = collection.owners[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) { | ||
| var collectionOwnerId = _step2.value; | ||
| if (collectionOwnerId === user.id) { | ||
| return true; | ||
| } | ||
| } | ||
| } catch (err) { | ||
| _didIteratorError2 = true; | ||
| _iteratorError2 = err; | ||
| } finally { | ||
| try { | ||
| if (!_iteratorNormalCompletion2 && _iterator2.return) { | ||
| _iterator2.return(); | ||
| } | ||
| } finally { | ||
| if (_didIteratorError2) { | ||
| throw _iteratorError2; | ||
| } | ||
| } | ||
| } | ||
| } | ||
| for (const team of user.teams) { | ||
| if (team.teamType.active()) { | ||
| if (team.teamType.permissions === 'all' && team.object === collection && operation === 'create') { | ||
| return true; | ||
| } | ||
| var _iteratorNormalCompletion3 = true; | ||
| var _didIteratorError3 = false; | ||
| var _iteratorError3 = undefined; | ||
| if (team.teamType.permissions === 'all' && team.object === fragment && (operation === 'update' || operation === 'delete')) { | ||
| return true; | ||
| } | ||
| try { | ||
| for (var _iterator3 = user.teams[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) { | ||
| var team = _step3.value; | ||
| if (team.teamType.permissions === 'create' && team.object === collection && operation === 'create') { | ||
| return true; | ||
| } | ||
| if (team.teamType.active()) { | ||
| if (team.teamType.permissions === 'all' && team.object === collection && operation === 'create') { | ||
| return true; | ||
| } | ||
| if (team.teamType.permissions === 'update' && team.object === fragment && operation === 'update') { | ||
| return true; | ||
| if (team.teamType.permissions === 'all' && team.object === fragment && (operation === 'update' || operation === 'delete')) { | ||
| return true; | ||
| } | ||
| if (team.teamType.permissions === 'create' && team.object === collection && operation === 'create') { | ||
| return true; | ||
| } | ||
| if (team.teamType.permissions === 'update' && team.object === fragment && operation === 'update') { | ||
| return true; | ||
| } | ||
| } | ||
| } | ||
| } catch (err) { | ||
| _didIteratorError3 = true; | ||
| _iteratorError3 = err; | ||
| } finally { | ||
| try { | ||
| if (!_iteratorNormalCompletion3 && _iterator3.return) { | ||
| _iterator3.return(); | ||
| } | ||
| } finally { | ||
| if (_didIteratorError3) { | ||
| throw _iteratorError3; | ||
| } | ||
| } | ||
| } | ||
| return false; | ||
@@ -44,0 +110,0 @@ }; |
@@ -0,1 +1,3 @@ | ||
| 'use strict'; | ||
| // WARNING: Used purely for testing reasons | ||
@@ -6,3 +8,3 @@ // - Everything is allowed for owners of objects or the objects' parents | ||
| // - User with id user_3 gets filteret results | ||
| var test = function (user, operation, object, context) { | ||
| var test = function test(user, operation, object, context) { | ||
| if (!user) { | ||
@@ -23,3 +25,5 @@ if (operation === 'GET' && object.public) { | ||
| permission: 'filter', | ||
| filter: object => object.owners.includes('user_3') | ||
| filter: function filter(object) { | ||
| return object.owners.includes('user_3'); | ||
| } | ||
| }; | ||
@@ -29,3 +33,5 @@ } else if (object && object.type === 'collection') { | ||
| permission: 'filter', | ||
| filter: (value, key) => key === 'id' | ||
| filter: function filter(value, key) { | ||
| return key === 'id'; | ||
| } | ||
| }; | ||
@@ -44,3 +50,3 @@ } | ||
| return context.models.collection.find(object.parents[0]).then(collection => { | ||
| return context.models.collection.find(object.parents[0]).then(function (collection) { | ||
| if (collection.owners.includes(user.id)) { | ||
@@ -47,0 +53,0 @@ return true; |
+4
-4
| { | ||
| "name": "authsome", | ||
| "version": "0.0.7", | ||
| "version": "0.0.8", | ||
| "description": "Flexible team-based authorization", | ||
@@ -23,4 +23,4 @@ "main": "dist/index.js", | ||
| "babel-core": "^6.10.4", | ||
| "babel-plugin-array-includes": "^2.0.3", | ||
| "babel-preset-es2015": "^6.9.0", | ||
| "babel-preset-env": "^1.6.0", | ||
| "babel-preset-stage-3": "^6.24.1", | ||
| "eslint": "^3.2.2", | ||
@@ -31,3 +31,3 @@ "eslint-config-standard": "^5.3.1", | ||
| "expect.js": "^0.3.1", | ||
| "jest": "^20.0.4", | ||
| "jest": "^21.2.1", | ||
| "lodash": "^4.17.4", | ||
@@ -34,0 +34,0 @@ "rimraf": "^2.6.2", |
+26
-51
@@ -0,1 +1,3 @@ | ||
| const pick = require('lodash/pick') | ||
| function isPublished (fragment) { | ||
@@ -10,7 +12,3 @@ return fragment.published | ||
| for (const ownerId of object.owners) { | ||
| if (ownerId === user.id) { | ||
| return true | ||
| } | ||
| } | ||
| return object.owners.includes(user.id) | ||
| } | ||
@@ -23,29 +21,14 @@ | ||
| for (const team of user.teams) { | ||
| if (team.teamType.permissions === 'POST' && | ||
| team.object.id === object.id && | ||
| operation === 'POST') { | ||
| return true | ||
| } else if (team.teamType.permissions === 'PATCH' && | ||
| team.object.id === object.id && | ||
| operation === 'PATCH') { | ||
| return true | ||
| } | ||
| } | ||
| return false | ||
| return user.teams.some(team => { | ||
| return ['POST', 'PATCH'].includes(operation) && | ||
| operation === team.teamType.permissions && | ||
| team.object.id === object.id | ||
| }) | ||
| } | ||
| function unauthenticatedUser (operation, object) { | ||
| // Public/unauthenticated users can GET /collections, filtered by 'published' | ||
| if (operation === 'GET' && object && object.path === '/collections') { | ||
| return { | ||
| filter: (collection) => collection.published | ||
| } | ||
| } | ||
| // Public/unauthenticated users can GET /collections/:id/fragments, filtered by 'published' | ||
| if (operation === 'GET' && object && object.path === '/collections/:id/fragments') { | ||
| return { | ||
| filter: (fragment) => fragment.published | ||
| filter: fragments => fragments.filter(isPublished) | ||
| } | ||
@@ -56,14 +39,10 @@ } | ||
| if (operation === 'GET' && object && object.type === 'collection') { | ||
| if (object.published) { | ||
| return { | ||
| filter: (_, key) => ['id', 'title', 'owners'].includes(key) | ||
| } | ||
| return { | ||
| filter: collection => pick(collection, ['id', 'title', 'owners']) | ||
| } | ||
| } | ||
| if (operation === 'GET' && object && object.type === 'fragment') { | ||
| if (object.published) { | ||
| return { | ||
| filter: (_, key) => ['id', 'title', 'source', 'presentation', 'owners'].includes(key) | ||
| } | ||
| if (operation === 'GET' && object && object.type === 'fragment' && object.published) { | ||
| return { | ||
| filter: fragment => pick(fragment, ['id', 'title', 'source', 'presentation', 'owners']) | ||
| } | ||
@@ -75,14 +54,14 @@ } | ||
| var blog = function (user, operation, object, context) { | ||
| // Admins can do anything | ||
| if (user && user.admin === true) return true | ||
| if (!user) { | ||
| async function blog (userId, operation, object, context) { | ||
| if (!userId) { | ||
| return unauthenticatedUser(operation, object) | ||
| } | ||
| let collection | ||
| const user = await context.models.User.find(userId) | ||
| // Admins can do anything | ||
| if (user && user.admin === true) return true | ||
| if (object.type === 'collection') { | ||
| collection = object | ||
| const collection = object | ||
| if (isOwner(user, collection)) { | ||
@@ -95,8 +74,4 @@ return true | ||
| } else if (object.type === 'fragment') { | ||
| let fragment = object | ||
| const fragment = object | ||
| if (isPublished(fragment) && operation === 'GET') { | ||
| return true | ||
| } | ||
| if (isOwner(user, fragment)) { | ||
@@ -110,5 +85,4 @@ return true | ||
| if (Array.isArray(fragment.parents)) { | ||
| collection = fragment.parents[0] | ||
| return teamPermissions(user, operation, collection) | ||
| if (Array.isArray(fragment.parents) && teamPermissions(user, operation, fragment.parents[0])) { | ||
| return true | ||
| } | ||
@@ -119,5 +93,6 @@ } else if (object.type === 'user') { | ||
| return false | ||
| // ensure a logged in user can do anything a non-logged in user can | ||
| return unauthenticatedUser(operation, object) | ||
| } | ||
| module.exports = blog |
Sorry, the diff of this file is not supported yet
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <coverage generated="1505902747187" clover="3.2.0"> | ||
| <project timestamp="1505902747187" name="All files"> | ||
| <metrics statements="145" coveredstatements="112" conditionals="197" coveredconditionals="147" methods="18" coveredmethods="14" elements="360" coveredelements="273" complexity="0" loc="145" ncloc="145" packages="5" files="5" classes="5"> | ||
| <package name="src"> | ||
| <metrics statements="13" coveredstatements="13" conditionals="8" coveredconditionals="8" methods="2" coveredmethods="2"/> | ||
| <file name="index.js" path="/Users/juretriglav/src/authsome/src/index.js"> | ||
| <metrics statements="13" coveredstatements="13" conditionals="8" coveredconditionals="8" methods="2" coveredmethods="2"/> | ||
| <line num="30" count="8" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="31" count="6" type="stmt"/> | ||
| <line num="32" count="6" type="stmt"/> | ||
| <line num="35" count="8" type="stmt"/> | ||
| <line num="37" count="8" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="38" count="2" type="stmt"/> | ||
| <line num="39" count="2" type="stmt"/> | ||
| <line num="44" count="30" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="45" count="1" type="stmt"/> | ||
| <line num="47" count="29" type="stmt"/> | ||
| <line num="48" count="29" type="stmt"/> | ||
| <line num="49" count="29" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="54" count="5" type="stmt"/> | ||
| </file> | ||
| </package> | ||
| <package name="src.modes.blog"> | ||
| <metrics statements="54" coveredstatements="34" conditionals="71" coveredconditionals="51" methods="9" coveredmethods="5"/> | ||
| <file name="index.js" path="/Users/juretriglav/src/authsome/src/modes/blog/index.js"> | ||
| <metrics statements="54" coveredstatements="34" conditionals="71" coveredconditionals="51" methods="9" coveredmethods="5"/> | ||
| <line num="2" count="5" type="stmt"/> | ||
| <line num="6" count="5" type="cond" truecount="4" falsecount="1"/> | ||
| <line num="7" count="0" type="stmt"/> | ||
| <line num="10" count="5" type="stmt"/> | ||
| <line num="11" count="5" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="12" count="3" type="stmt"/> | ||
| <line num="18" count="3" type="cond" truecount="3" falsecount="1"/> | ||
| <line num="19" count="0" type="stmt"/> | ||
| <line num="22" count="3" type="stmt"/> | ||
| <line num="23" count="3" type="cond" truecount="4" falsecount="1"/> | ||
| <line num="26" count="0" type="stmt"/> | ||
| <line num="27" count="3" type="cond" truecount="5" falsecount="0"/> | ||
| <line num="30" count="1" type="stmt"/> | ||
| <line num="34" count="2" type="stmt"/> | ||
| <line num="39" count="2" type="cond" truecount="4" falsecount="1"/> | ||
| <line num="40" count="0" type="stmt"/> | ||
| <line num="41" count="0" type="stmt"/> | ||
| <line num="46" count="2" type="cond" truecount="4" falsecount="1"/> | ||
| <line num="47" count="0" type="stmt"/> | ||
| <line num="48" count="0" type="stmt"/> | ||
| <line num="53" count="2" type="cond" truecount="4" falsecount="1"/> | ||
| <line num="54" count="0" type="cond" truecount="0" falsecount="2"/> | ||
| <line num="55" count="0" type="stmt"/> | ||
| <line num="56" count="0" type="stmt"/> | ||
| <line num="61" count="2" type="cond" truecount="4" falsecount="1"/> | ||
| <line num="62" count="2" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="63" count="1" type="stmt"/> | ||
| <line num="64" count="0" type="stmt"/> | ||
| <line num="69" count="1" type="stmt"/> | ||
| <line num="72" count="1" type="stmt"/> | ||
| <line num="74" count="9" type="cond" truecount="4" falsecount="0"/> | ||
| <line num="76" count="7" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="77" count="2" type="stmt"/> | ||
| <line num="82" count="5" type="cond" truecount="1" falsecount="1"/> | ||
| <line num="83" count="0" type="stmt"/> | ||
| <line num="84" count="0" type="cond" truecount="0" falsecount="2"/> | ||
| <line num="85" count="0" type="stmt"/> | ||
| <line num="87" count="0" type="cond" truecount="0" falsecount="2"/> | ||
| <line num="88" count="0" type="stmt"/> | ||
| <line num="90" count="5" type="cond" truecount="1" falsecount="1"/> | ||
| <line num="91" count="5" type="stmt"/> | ||
| <line num="93" count="5" type="cond" truecount="2" falsecount="2"/> | ||
| <line num="94" count="0" type="stmt"/> | ||
| <line num="97" count="5" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="98" count="3" type="stmt"/> | ||
| <line num="101" count="2" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="102" count="1" type="stmt"/> | ||
| <line num="105" count="1" type="cond" truecount="1" falsecount="1"/> | ||
| <line num="106" count="1" type="stmt"/> | ||
| <line num="107" count="1" type="stmt"/> | ||
| <line num="109" count="0" type="cond" truecount="0" falsecount="2"/> | ||
| <line num="110" count="0" type="stmt"/> | ||
| <line num="113" count="0" type="stmt"/> | ||
| <line num="116" count="1" type="stmt"/> | ||
| </file> | ||
| </package> | ||
| <package name="src.modes.journal"> | ||
| <metrics statements="32" coveredstatements="30" conditionals="52" coveredconditionals="48" methods="2" coveredmethods="2"/> | ||
| <file name="index.js" path="/Users/juretriglav/src/authsome/src/modes/journal/index.js"> | ||
| <metrics statements="32" coveredstatements="30" conditionals="52" coveredconditionals="48" methods="2" coveredmethods="2"/> | ||
| <line num="2" count="14" type="cond" truecount="6" falsecount="0"/> | ||
| <line num="4" count="3" type="stmt"/> | ||
| <line num="7" count="11" type="cond" truecount="4" falsecount="1"/> | ||
| <line num="9" count="0" type="stmt"/> | ||
| <line num="12" count="11" type="cond" truecount="4" falsecount="0"/> | ||
| <line num="14" count="2" type="stmt"/> | ||
| <line num="17" count="9" type="cond" truecount="4" falsecount="0"/> | ||
| <line num="19" count="2" type="stmt"/> | ||
| <line num="25" count="14" type="cond" truecount="5" falsecount="0"/> | ||
| <line num="28" count="1" type="stmt"/> | ||
| <line num="29" count="13" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="30" count="1" type="stmt"/> | ||
| <line num="35" count="12" type="cond" truecount="1" falsecount="1"/> | ||
| <line num="37" count="12" type="stmt"/> | ||
| <line num="38" count="18" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="39" count="3" type="stmt"/> | ||
| <line num="43" count="9" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="44" count="7" type="stmt"/> | ||
| <line num="45" count="7" type="cond" truecount="1" falsecount="1"/> | ||
| <line num="46" count="0" type="stmt"/> | ||
| <line num="53" count="9" type="stmt"/> | ||
| <line num="54" count="14" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="55" count="3" type="cond" truecount="5" falsecount="0"/> | ||
| <line num="58" count="1" type="stmt"/> | ||
| <line num="61" count="11" type="cond" truecount="4" falsecount="0"/> | ||
| <line num="63" count="2" type="stmt"/> | ||
| <line num="71" count="6" type="cond" truecount="5" falsecount="0"/> | ||
| <line num="73" count="3" type="stmt"/> | ||
| <line num="74" count="3" type="cond" truecount="1" falsecount="1"/> | ||
| <line num="75" count="3" type="stmt"/> | ||
| <line num="80" count="3" type="stmt"/> | ||
| <line num="83" count="1" type="stmt"/> | ||
| </file> | ||
| </package> | ||
| <package name="src.modes.noon"> | ||
| <metrics statements="24" coveredstatements="14" conditionals="35" coveredconditionals="12" methods="1" coveredmethods="1"/> | ||
| <file name="index.js" path="/Users/juretriglav/src/authsome/src/modes/noon/index.js"> | ||
| <metrics statements="24" coveredstatements="14" conditionals="35" coveredconditionals="12" methods="1" coveredmethods="1"/> | ||
| <line num="1" count="1" type="stmt"/> | ||
| <line num="2" count="2" type="stmt"/> | ||
| <line num="3" count="2" type="stmt"/> | ||
| <line num="5" count="2" type="cond" truecount="1" falsecount="1"/> | ||
| <line num="7" count="2" type="cond" truecount="3" falsecount="1"/> | ||
| <line num="8" count="0" type="stmt"/> | ||
| <line num="9" count="0" type="cond" truecount="0" falsecount="2"/> | ||
| <line num="10" count="0" type="stmt"/> | ||
| <line num="15" count="2" type="cond" truecount="1" falsecount="1"/> | ||
| <line num="16" count="2" type="stmt"/> | ||
| <line num="17" count="2" type="cond" truecount="1" falsecount="1"/> | ||
| <line num="18" count="0" type="stmt"/> | ||
| <line num="23" count="2" type="stmt"/> | ||
| <line num="24" count="2" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="25" count="1" type="cond" truecount="4" falsecount="1"/> | ||
| <line num="28" count="1" type="stmt"/> | ||
| <line num="31" count="0" type="cond" truecount="0" falsecount="6"/> | ||
| <line num="34" count="0" type="stmt"/> | ||
| <line num="37" count="0" type="cond" truecount="0" falsecount="5"/> | ||
| <line num="40" count="0" type="stmt"/> | ||
| <line num="43" count="0" type="cond" truecount="0" falsecount="5"/> | ||
| <line num="46" count="0" type="stmt"/> | ||
| <line num="50" count="1" type="stmt"/> | ||
| <line num="53" count="1" type="stmt"/> | ||
| </file> | ||
| </package> | ||
| <package name="src.modes.test"> | ||
| <metrics statements="22" coveredstatements="21" conditionals="31" coveredconditionals="28" methods="4" coveredmethods="4"/> | ||
| <file name="index.js" path="/Users/juretriglav/src/authsome/src/modes/test/index.js"> | ||
| <metrics statements="22" coveredstatements="21" conditionals="31" coveredconditionals="28" methods="4" coveredmethods="4"/> | ||
| <line num="6" count="1" type="stmt"/> | ||
| <line num="7" count="7" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="8" count="2" type="cond" truecount="4" falsecount="0"/> | ||
| <line num="9" count="1" type="stmt"/> | ||
| <line num="11" count="1" type="stmt"/> | ||
| <line num="18" count="5" type="cond" truecount="4" falsecount="0"/> | ||
| <line num="19" count="2" type="cond" truecount="2" falsecount="0"/> | ||
| <line num="20" count="1" type="stmt"/> | ||
| <line num="22" count="1" type="stmt"/> | ||
| <line num="24" count="1" type="cond" truecount="3" falsecount="1"/> | ||
| <line num="25" count="1" type="stmt"/> | ||
| <line num="27" count="4" type="stmt"/> | ||
| <line num="32" count="3" type="cond" truecount="5" falsecount="0"/> | ||
| <line num="33" count="1" type="stmt"/> | ||
| <line num="36" count="2" type="cond" truecount="6" falsecount="0"/> | ||
| <line num="37" count="1" type="cond" truecount="1" falsecount="1"/> | ||
| <line num="38" count="0" type="stmt"/> | ||
| <line num="41" count="1" type="stmt"/> | ||
| <line num="42" count="1" type="cond" truecount="1" falsecount="1"/> | ||
| <line num="43" count="1" type="stmt"/> | ||
| <line num="48" count="1" type="stmt"/> | ||
| <line num="51" count="1" type="stmt"/> | ||
| </file> | ||
| </package> | ||
| </metrics> | ||
| </project> | ||
| </coverage> |
| {"/Users/juretriglav/src/authsome/src/index.js": {"path":"/Users/juretriglav/src/authsome/src/index.js","statementMap":{"0":{"start":{"line":30,"column":4},"end":{"line":33,"column":5}},"1":{"start":{"line":31,"column":6},"end":{"line":31,"column":29}},"2":{"start":{"line":32,"column":6},"end":{"line":32,"column":31}},"3":{"start":{"line":35,"column":4},"end":{"line":35,"column":26}},"4":{"start":{"line":37,"column":4},"end":{"line":40,"column":5}},"5":{"start":{"line":38,"column":6},"end":{"line":38,"column":31}},"6":{"start":{"line":39,"column":6},"end":{"line":39,"column":28}},"7":{"start":{"line":44,"column":4},"end":{"line":50,"column":5}},"8":{"start":{"line":45,"column":6},"end":{"line":45,"column":35}},"9":{"start":{"line":47,"column":19},"end":{"line":47,"column":67}},"10":{"start":{"line":48,"column":22},"end":{"line":48,"column":55}},"11":{"start":{"line":49,"column":6},"end":{"line":49,"column":57}},"12":{"start":{"line":54,"column":0},"end":{"line":54,"column":25}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":29,"column":2},"end":{"line":29,"column":3}},"loc":{"start":{"line":29,"column":32},"end":{"line":41,"column":3}},"line":29},"1":{"name":"(anonymous_1)","decl":{"start":{"line":43,"column":2},"end":{"line":43,"column":3}},"loc":{"start":{"line":43,"column":32},"end":{"line":51,"column":3}},"line":43}},"branchMap":{"0":{"loc":{"start":{"line":30,"column":4},"end":{"line":33,"column":5}},"type":"if","locations":[{"start":{"line":30,"column":4},"end":{"line":33,"column":5}},{"start":{"line":30,"column":4},"end":{"line":33,"column":5}}],"line":30},"1":{"loc":{"start":{"line":37,"column":4},"end":{"line":40,"column":5}},"type":"if","locations":[{"start":{"line":37,"column":4},"end":{"line":40,"column":5}},{"start":{"line":37,"column":4},"end":{"line":40,"column":5}}],"line":37},"2":{"loc":{"start":{"line":44,"column":4},"end":{"line":50,"column":5}},"type":"if","locations":[{"start":{"line":44,"column":4},"end":{"line":50,"column":5}},{"start":{"line":44,"column":4},"end":{"line":50,"column":5}}],"line":44},"3":{"loc":{"start":{"line":49,"column":13},"end":{"line":49,"column":57}},"type":"cond-expr","locations":[{"start":{"line":49,"column":25},"end":{"line":49,"column":31}},{"start":{"line":49,"column":34},"end":{"line":49,"column":57}}],"line":49}},"s":{"0":8,"1":6,"2":6,"3":8,"4":8,"5":2,"6":2,"7":30,"8":1,"9":29,"10":29,"11":29,"12":5},"f":{"0":8,"1":30},"b":{"0":[6,2],"1":[2,6],"2":[1,29],"3":[1,28]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"d436dd5be3f6a38c8b03bbcb001c4803fd8d0225"} | ||
| ,"/Users/juretriglav/src/authsome/src/modes/blog/index.js": {"path":"/Users/juretriglav/src/authsome/src/modes/blog/index.js","statementMap":{"0":{"start":{"line":2,"column":2},"end":{"line":2,"column":27}},"1":{"start":{"line":6,"column":2},"end":{"line":8,"column":3}},"2":{"start":{"line":7,"column":4},"end":{"line":7,"column":16}},"3":{"start":{"line":10,"column":2},"end":{"line":14,"column":3}},"4":{"start":{"line":11,"column":4},"end":{"line":13,"column":5}},"5":{"start":{"line":12,"column":6},"end":{"line":12,"column":17}},"6":{"start":{"line":18,"column":2},"end":{"line":20,"column":3}},"7":{"start":{"line":19,"column":4},"end":{"line":19,"column":16}},"8":{"start":{"line":22,"column":2},"end":{"line":32,"column":3}},"9":{"start":{"line":23,"column":4},"end":{"line":31,"column":5}},"10":{"start":{"line":26,"column":6},"end":{"line":26,"column":17}},"11":{"start":{"line":27,"column":11},"end":{"line":31,"column":5}},"12":{"start":{"line":30,"column":6},"end":{"line":30,"column":17}},"13":{"start":{"line":34,"column":2},"end":{"line":34,"column":14}},"14":{"start":{"line":39,"column":2},"end":{"line":43,"column":3}},"15":{"start":{"line":40,"column":4},"end":{"line":42,"column":5}},"16":{"start":{"line":41,"column":30},"end":{"line":41,"column":50}},"17":{"start":{"line":46,"column":2},"end":{"line":50,"column":3}},"18":{"start":{"line":47,"column":4},"end":{"line":49,"column":5}},"19":{"start":{"line":48,"column":28},"end":{"line":48,"column":46}},"20":{"start":{"line":53,"column":2},"end":{"line":59,"column":3}},"21":{"start":{"line":54,"column":4},"end":{"line":58,"column":5}},"22":{"start":{"line":55,"column":6},"end":{"line":57,"column":7}},"23":{"start":{"line":56,"column":28},"end":{"line":56,"column":67}},"24":{"start":{"line":61,"column":2},"end":{"line":67,"column":3}},"25":{"start":{"line":62,"column":4},"end":{"line":66,"column":5}},"26":{"start":{"line":63,"column":6},"end":{"line":65,"column":7}},"27":{"start":{"line":64,"column":28},"end":{"line":64,"column":93}},"28":{"start":{"line":69,"column":2},"end":{"line":69,"column":14}},"29":{"start":{"line":72,"column":11},"end":{"line":114,"column":1}},"30":{"start":{"line":74,"column":2},"end":{"line":74,"column":46}},"31":{"start":{"line":74,"column":35},"end":{"line":74,"column":46}},"32":{"start":{"line":76,"column":2},"end":{"line":78,"column":3}},"33":{"start":{"line":77,"column":4},"end":{"line":77,"column":49}},"34":{"start":{"line":82,"column":2},"end":{"line":111,"column":3}},"35":{"start":{"line":83,"column":4},"end":{"line":83,"column":23}},"36":{"start":{"line":84,"column":4},"end":{"line":86,"column":5}},"37":{"start":{"line":85,"column":6},"end":{"line":85,"column":17}},"38":{"start":{"line":87,"column":4},"end":{"line":89,"column":5}},"39":{"start":{"line":88,"column":6},"end":{"line":88,"column":17}},"40":{"start":{"line":90,"column":9},"end":{"line":111,"column":3}},"41":{"start":{"line":91,"column":19},"end":{"line":91,"column":25}},"42":{"start":{"line":93,"column":4},"end":{"line":95,"column":5}},"43":{"start":{"line":94,"column":6},"end":{"line":94,"column":17}},"44":{"start":{"line":97,"column":4},"end":{"line":99,"column":5}},"45":{"start":{"line":98,"column":6},"end":{"line":98,"column":17}},"46":{"start":{"line":101,"column":4},"end":{"line":103,"column":5}},"47":{"start":{"line":102,"column":6},"end":{"line":102,"column":17}},"48":{"start":{"line":105,"column":4},"end":{"line":108,"column":5}},"49":{"start":{"line":106,"column":6},"end":{"line":106,"column":38}},"50":{"start":{"line":107,"column":6},"end":{"line":107,"column":57}},"51":{"start":{"line":109,"column":9},"end":{"line":111,"column":3}},"52":{"start":{"line":110,"column":4},"end":{"line":110,"column":32}},"53":{"start":{"line":113,"column":2},"end":{"line":113,"column":14}},"54":{"start":{"line":116,"column":0},"end":{"line":116,"column":21}}},"fnMap":{"0":{"name":"isPublished","decl":{"start":{"line":1,"column":9},"end":{"line":1,"column":20}},"loc":{"start":{"line":1,"column":32},"end":{"line":3,"column":1}},"line":1},"1":{"name":"isOwner","decl":{"start":{"line":5,"column":9},"end":{"line":5,"column":16}},"loc":{"start":{"line":5,"column":32},"end":{"line":15,"column":1}},"line":5},"2":{"name":"teamPermissions","decl":{"start":{"line":17,"column":9},"end":{"line":17,"column":24}},"loc":{"start":{"line":17,"column":51},"end":{"line":35,"column":1}},"line":17},"3":{"name":"unauthenticatedUser","decl":{"start":{"line":37,"column":9},"end":{"line":37,"column":28}},"loc":{"start":{"line":37,"column":49},"end":{"line":70,"column":1}},"line":37},"4":{"name":"(anonymous_4)","decl":{"start":{"line":41,"column":14},"end":{"line":41,"column":15}},"loc":{"start":{"line":41,"column":30},"end":{"line":41,"column":50}},"line":41},"5":{"name":"(anonymous_5)","decl":{"start":{"line":48,"column":14},"end":{"line":48,"column":15}},"loc":{"start":{"line":48,"column":28},"end":{"line":48,"column":46}},"line":48},"6":{"name":"(anonymous_6)","decl":{"start":{"line":56,"column":16},"end":{"line":56,"column":17}},"loc":{"start":{"line":56,"column":28},"end":{"line":56,"column":67}},"line":56},"7":{"name":"(anonymous_7)","decl":{"start":{"line":64,"column":16},"end":{"line":64,"column":17}},"loc":{"start":{"line":64,"column":28},"end":{"line":64,"column":93}},"line":64},"8":{"name":"(anonymous_8)","decl":{"start":{"line":72,"column":11},"end":{"line":72,"column":12}},"loc":{"start":{"line":72,"column":55},"end":{"line":114,"column":1}},"line":72}},"branchMap":{"0":{"loc":{"start":{"line":6,"column":2},"end":{"line":8,"column":3}},"type":"if","locations":[{"start":{"line":6,"column":2},"end":{"line":8,"column":3}},{"start":{"line":6,"column":2},"end":{"line":8,"column":3}}],"line":6},"1":{"loc":{"start":{"line":6,"column":6},"end":{"line":6,"column":40}},"type":"binary-expr","locations":[{"start":{"line":6,"column":6},"end":{"line":6,"column":13}},{"start":{"line":6,"column":17},"end":{"line":6,"column":31}},{"start":{"line":6,"column":35},"end":{"line":6,"column":40}}],"line":6},"2":{"loc":{"start":{"line":11,"column":4},"end":{"line":13,"column":5}},"type":"if","locations":[{"start":{"line":11,"column":4},"end":{"line":13,"column":5}},{"start":{"line":11,"column":4},"end":{"line":13,"column":5}}],"line":11},"3":{"loc":{"start":{"line":18,"column":2},"end":{"line":20,"column":3}},"type":"if","locations":[{"start":{"line":18,"column":2},"end":{"line":20,"column":3}},{"start":{"line":18,"column":2},"end":{"line":20,"column":3}}],"line":18},"4":{"loc":{"start":{"line":18,"column":6},"end":{"line":18,"column":41}},"type":"binary-expr","locations":[{"start":{"line":18,"column":6},"end":{"line":18,"column":11}},{"start":{"line":18,"column":15},"end":{"line":18,"column":41}}],"line":18},"5":{"loc":{"start":{"line":23,"column":4},"end":{"line":31,"column":5}},"type":"if","locations":[{"start":{"line":23,"column":4},"end":{"line":31,"column":5}},{"start":{"line":23,"column":4},"end":{"line":31,"column":5}}],"line":23},"6":{"loc":{"start":{"line":23,"column":8},"end":{"line":25,"column":28}},"type":"binary-expr","locations":[{"start":{"line":23,"column":8},"end":{"line":23,"column":44}},{"start":{"line":24,"column":8},"end":{"line":24,"column":36}},{"start":{"line":25,"column":8},"end":{"line":25,"column":28}}],"line":23},"7":{"loc":{"start":{"line":27,"column":11},"end":{"line":31,"column":5}},"type":"if","locations":[{"start":{"line":27,"column":11},"end":{"line":31,"column":5}},{"start":{"line":27,"column":11},"end":{"line":31,"column":5}}],"line":27},"8":{"loc":{"start":{"line":27,"column":15},"end":{"line":29,"column":29}},"type":"binary-expr","locations":[{"start":{"line":27,"column":15},"end":{"line":27,"column":52}},{"start":{"line":28,"column":8},"end":{"line":28,"column":36}},{"start":{"line":29,"column":8},"end":{"line":29,"column":29}}],"line":27},"9":{"loc":{"start":{"line":39,"column":2},"end":{"line":43,"column":3}},"type":"if","locations":[{"start":{"line":39,"column":2},"end":{"line":43,"column":3}},{"start":{"line":39,"column":2},"end":{"line":43,"column":3}}],"line":39},"10":{"loc":{"start":{"line":39,"column":6},"end":{"line":39,"column":69}},"type":"binary-expr","locations":[{"start":{"line":39,"column":6},"end":{"line":39,"column":25}},{"start":{"line":39,"column":29},"end":{"line":39,"column":35}},{"start":{"line":39,"column":39},"end":{"line":39,"column":69}}],"line":39},"11":{"loc":{"start":{"line":46,"column":2},"end":{"line":50,"column":3}},"type":"if","locations":[{"start":{"line":46,"column":2},"end":{"line":50,"column":3}},{"start":{"line":46,"column":2},"end":{"line":50,"column":3}}],"line":46},"12":{"loc":{"start":{"line":46,"column":6},"end":{"line":46,"column":83}},"type":"binary-expr","locations":[{"start":{"line":46,"column":6},"end":{"line":46,"column":25}},{"start":{"line":46,"column":29},"end":{"line":46,"column":35}},{"start":{"line":46,"column":39},"end":{"line":46,"column":83}}],"line":46},"13":{"loc":{"start":{"line":53,"column":2},"end":{"line":59,"column":3}},"type":"if","locations":[{"start":{"line":53,"column":2},"end":{"line":59,"column":3}},{"start":{"line":53,"column":2},"end":{"line":59,"column":3}}],"line":53},"14":{"loc":{"start":{"line":53,"column":6},"end":{"line":53,"column":67}},"type":"binary-expr","locations":[{"start":{"line":53,"column":6},"end":{"line":53,"column":25}},{"start":{"line":53,"column":29},"end":{"line":53,"column":35}},{"start":{"line":53,"column":39},"end":{"line":53,"column":67}}],"line":53},"15":{"loc":{"start":{"line":54,"column":4},"end":{"line":58,"column":5}},"type":"if","locations":[{"start":{"line":54,"column":4},"end":{"line":58,"column":5}},{"start":{"line":54,"column":4},"end":{"line":58,"column":5}}],"line":54},"16":{"loc":{"start":{"line":61,"column":2},"end":{"line":67,"column":3}},"type":"if","locations":[{"start":{"line":61,"column":2},"end":{"line":67,"column":3}},{"start":{"line":61,"column":2},"end":{"line":67,"column":3}}],"line":61},"17":{"loc":{"start":{"line":61,"column":6},"end":{"line":61,"column":65}},"type":"binary-expr","locations":[{"start":{"line":61,"column":6},"end":{"line":61,"column":25}},{"start":{"line":61,"column":29},"end":{"line":61,"column":35}},{"start":{"line":61,"column":39},"end":{"line":61,"column":65}}],"line":61},"18":{"loc":{"start":{"line":62,"column":4},"end":{"line":66,"column":5}},"type":"if","locations":[{"start":{"line":62,"column":4},"end":{"line":66,"column":5}},{"start":{"line":62,"column":4},"end":{"line":66,"column":5}}],"line":62},"19":{"loc":{"start":{"line":74,"column":2},"end":{"line":74,"column":46}},"type":"if","locations":[{"start":{"line":74,"column":2},"end":{"line":74,"column":46}},{"start":{"line":74,"column":2},"end":{"line":74,"column":46}}],"line":74},"20":{"loc":{"start":{"line":74,"column":6},"end":{"line":74,"column":33}},"type":"binary-expr","locations":[{"start":{"line":74,"column":6},"end":{"line":74,"column":10}},{"start":{"line":74,"column":14},"end":{"line":74,"column":33}}],"line":74},"21":{"loc":{"start":{"line":76,"column":2},"end":{"line":78,"column":3}},"type":"if","locations":[{"start":{"line":76,"column":2},"end":{"line":78,"column":3}},{"start":{"line":76,"column":2},"end":{"line":78,"column":3}}],"line":76},"22":{"loc":{"start":{"line":82,"column":2},"end":{"line":111,"column":3}},"type":"if","locations":[{"start":{"line":82,"column":2},"end":{"line":111,"column":3}},{"start":{"line":82,"column":2},"end":{"line":111,"column":3}}],"line":82},"23":{"loc":{"start":{"line":84,"column":4},"end":{"line":86,"column":5}},"type":"if","locations":[{"start":{"line":84,"column":4},"end":{"line":86,"column":5}},{"start":{"line":84,"column":4},"end":{"line":86,"column":5}}],"line":84},"24":{"loc":{"start":{"line":87,"column":4},"end":{"line":89,"column":5}},"type":"if","locations":[{"start":{"line":87,"column":4},"end":{"line":89,"column":5}},{"start":{"line":87,"column":4},"end":{"line":89,"column":5}}],"line":87},"25":{"loc":{"start":{"line":90,"column":9},"end":{"line":111,"column":3}},"type":"if","locations":[{"start":{"line":90,"column":9},"end":{"line":111,"column":3}},{"start":{"line":90,"column":9},"end":{"line":111,"column":3}}],"line":90},"26":{"loc":{"start":{"line":93,"column":4},"end":{"line":95,"column":5}},"type":"if","locations":[{"start":{"line":93,"column":4},"end":{"line":95,"column":5}},{"start":{"line":93,"column":4},"end":{"line":95,"column":5}}],"line":93},"27":{"loc":{"start":{"line":93,"column":8},"end":{"line":93,"column":52}},"type":"binary-expr","locations":[{"start":{"line":93,"column":8},"end":{"line":93,"column":29}},{"start":{"line":93,"column":33},"end":{"line":93,"column":52}}],"line":93},"28":{"loc":{"start":{"line":97,"column":4},"end":{"line":99,"column":5}},"type":"if","locations":[{"start":{"line":97,"column":4},"end":{"line":99,"column":5}},{"start":{"line":97,"column":4},"end":{"line":99,"column":5}}],"line":97},"29":{"loc":{"start":{"line":101,"column":4},"end":{"line":103,"column":5}},"type":"if","locations":[{"start":{"line":101,"column":4},"end":{"line":103,"column":5}},{"start":{"line":101,"column":4},"end":{"line":103,"column":5}}],"line":101},"30":{"loc":{"start":{"line":105,"column":4},"end":{"line":108,"column":5}},"type":"if","locations":[{"start":{"line":105,"column":4},"end":{"line":108,"column":5}},{"start":{"line":105,"column":4},"end":{"line":108,"column":5}}],"line":105},"31":{"loc":{"start":{"line":109,"column":9},"end":{"line":111,"column":3}},"type":"if","locations":[{"start":{"line":109,"column":9},"end":{"line":111,"column":3}},{"start":{"line":109,"column":9},"end":{"line":111,"column":3}}],"line":109}},"s":{"0":5,"1":5,"2":0,"3":5,"4":5,"5":3,"6":3,"7":0,"8":3,"9":3,"10":0,"11":3,"12":1,"13":2,"14":2,"15":0,"16":0,"17":2,"18":0,"19":0,"20":2,"21":0,"22":0,"23":0,"24":2,"25":2,"26":1,"27":0,"28":1,"29":1,"30":9,"31":2,"32":7,"33":2,"34":5,"35":0,"36":0,"37":0,"38":0,"39":0,"40":5,"41":5,"42":5,"43":0,"44":5,"45":3,"46":2,"47":1,"48":1,"49":1,"50":1,"51":0,"52":0,"53":0,"54":1},"f":{"0":5,"1":5,"2":3,"3":2,"4":0,"5":0,"6":0,"7":0,"8":9},"b":{"0":[0,5],"1":[5,5,5],"2":[3,2],"3":[0,3],"4":[3,3],"5":[0,3],"6":[3,2,1],"7":[1,2],"8":[3,1,1],"9":[0,2],"10":[2,2,2],"11":[0,2],"12":[2,2,2],"13":[0,2],"14":[2,2,2],"15":[0,0],"16":[2,0],"17":[2,2,2],"18":[1,1],"19":[2,7],"20":[9,7],"21":[2,5],"22":[0,5],"23":[0,0],"24":[0,0],"25":[5,0],"26":[0,5],"27":[5,0],"28":[3,2],"29":[1,1],"30":[1,0],"31":[0,0]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"4f84e12faaa4bdbaf35024b87d275d94f37ec806"} | ||
| ,"/Users/juretriglav/src/authsome/src/modes/journal/index.js": {"path":"/Users/juretriglav/src/authsome/src/modes/journal/index.js","statementMap":{"0":{"start":{"line":2,"column":2},"end":{"line":5,"column":3}},"1":{"start":{"line":4,"column":4},"end":{"line":4,"column":15}},"2":{"start":{"line":7,"column":2},"end":{"line":10,"column":3}},"3":{"start":{"line":9,"column":4},"end":{"line":9,"column":15}},"4":{"start":{"line":12,"column":2},"end":{"line":15,"column":3}},"5":{"start":{"line":14,"column":4},"end":{"line":14,"column":15}},"6":{"start":{"line":17,"column":2},"end":{"line":20,"column":3}},"7":{"start":{"line":19,"column":4},"end":{"line":19,"column":15}},"8":{"start":{"line":25,"column":2},"end":{"line":31,"column":3}},"9":{"start":{"line":28,"column":4},"end":{"line":28,"column":15}},"10":{"start":{"line":29,"column":9},"end":{"line":31,"column":3}},"11":{"start":{"line":30,"column":4},"end":{"line":30,"column":16}},"12":{"start":{"line":35,"column":2},"end":{"line":35,"column":38}},"13":{"start":{"line":35,"column":27},"end":{"line":35,"column":38}},"14":{"start":{"line":37,"column":2},"end":{"line":41,"column":3}},"15":{"start":{"line":38,"column":4},"end":{"line":40,"column":5}},"16":{"start":{"line":39,"column":6},"end":{"line":39,"column":17}},"17":{"start":{"line":43,"column":2},"end":{"line":49,"column":3}},"18":{"start":{"line":44,"column":4},"end":{"line":48,"column":5}},"19":{"start":{"line":45,"column":6},"end":{"line":47,"column":7}},"20":{"start":{"line":46,"column":8},"end":{"line":46,"column":19}},"21":{"start":{"line":53,"column":2},"end":{"line":66,"column":3}},"22":{"start":{"line":54,"column":4},"end":{"line":65,"column":5}},"23":{"start":{"line":55,"column":6},"end":{"line":59,"column":7}},"24":{"start":{"line":58,"column":8},"end":{"line":58,"column":19}},"25":{"start":{"line":61,"column":6},"end":{"line":64,"column":7}},"26":{"start":{"line":63,"column":8},"end":{"line":63,"column":19}},"27":{"start":{"line":71,"column":2},"end":{"line":78,"column":3}},"28":{"start":{"line":73,"column":4},"end":{"line":77,"column":5}},"29":{"start":{"line":74,"column":6},"end":{"line":76,"column":7}},"30":{"start":{"line":75,"column":8},"end":{"line":75,"column":19}},"31":{"start":{"line":80,"column":2},"end":{"line":80,"column":14}},"32":{"start":{"line":83,"column":0},"end":{"line":83,"column":20}}},"fnMap":{"0":{"name":"isAllowed","decl":{"start":{"line":1,"column":9},"end":{"line":1,"column":18}},"loc":{"start":{"line":1,"column":43},"end":{"line":21,"column":1}},"line":1},"1":{"name":"can","decl":{"start":{"line":23,"column":9},"end":{"line":23,"column":12}},"loc":{"start":{"line":23,"column":39},"end":{"line":81,"column":1}},"line":23}},"branchMap":{"0":{"loc":{"start":{"line":2,"column":2},"end":{"line":5,"column":3}},"type":"if","locations":[{"start":{"line":2,"column":2},"end":{"line":5,"column":3}},{"start":{"line":2,"column":2},"end":{"line":5,"column":3}}],"line":2},"1":{"loc":{"start":{"line":2,"column":6},"end":{"line":3,"column":27}},"type":"binary-expr","locations":[{"start":{"line":2,"column":7},"end":{"line":2,"column":27}},{"start":{"line":2,"column":31},"end":{"line":2,"column":53}},{"start":{"line":2,"column":57},"end":{"line":2,"column":79}},{"start":{"line":3,"column":4},"end":{"line":3,"column":27}}],"line":2},"2":{"loc":{"start":{"line":7,"column":2},"end":{"line":10,"column":3}},"type":"if","locations":[{"start":{"line":7,"column":2},"end":{"line":10,"column":3}},{"start":{"line":7,"column":2},"end":{"line":10,"column":3}}],"line":7},"3":{"loc":{"start":{"line":7,"column":6},"end":{"line":8,"column":27}},"type":"binary-expr","locations":[{"start":{"line":7,"column":7},"end":{"line":7,"column":27}},{"start":{"line":7,"column":31},"end":{"line":7,"column":53}},{"start":{"line":8,"column":4},"end":{"line":8,"column":27}}],"line":7},"4":{"loc":{"start":{"line":12,"column":2},"end":{"line":15,"column":3}},"type":"if","locations":[{"start":{"line":12,"column":2},"end":{"line":15,"column":3}},{"start":{"line":12,"column":2},"end":{"line":15,"column":3}}],"line":12},"5":{"loc":{"start":{"line":12,"column":6},"end":{"line":13,"column":25}},"type":"binary-expr","locations":[{"start":{"line":12,"column":7},"end":{"line":12,"column":27}},{"start":{"line":13,"column":4},"end":{"line":13,"column":25}}],"line":12},"6":{"loc":{"start":{"line":17,"column":2},"end":{"line":20,"column":3}},"type":"if","locations":[{"start":{"line":17,"column":2},"end":{"line":20,"column":3}},{"start":{"line":17,"column":2},"end":{"line":20,"column":3}}],"line":17},"7":{"loc":{"start":{"line":17,"column":6},"end":{"line":18,"column":27}},"type":"binary-expr","locations":[{"start":{"line":17,"column":7},"end":{"line":17,"column":29}},{"start":{"line":18,"column":4},"end":{"line":18,"column":27}}],"line":17},"8":{"loc":{"start":{"line":25,"column":2},"end":{"line":31,"column":3}},"type":"if","locations":[{"start":{"line":25,"column":2},"end":{"line":31,"column":3}},{"start":{"line":25,"column":2},"end":{"line":31,"column":3}}],"line":25},"9":{"loc":{"start":{"line":25,"column":6},"end":{"line":27,"column":26}},"type":"binary-expr","locations":[{"start":{"line":25,"column":6},"end":{"line":25,"column":32}},{"start":{"line":26,"column":6},"end":{"line":26,"column":34}},{"start":{"line":27,"column":6},"end":{"line":27,"column":26}}],"line":25},"10":{"loc":{"start":{"line":29,"column":9},"end":{"line":31,"column":3}},"type":"if","locations":[{"start":{"line":29,"column":9},"end":{"line":31,"column":3}},{"start":{"line":29,"column":9},"end":{"line":31,"column":3}}],"line":29},"11":{"loc":{"start":{"line":35,"column":2},"end":{"line":35,"column":38}},"type":"if","locations":[{"start":{"line":35,"column":2},"end":{"line":35,"column":38}},{"start":{"line":35,"column":2},"end":{"line":35,"column":38}}],"line":35},"12":{"loc":{"start":{"line":38,"column":4},"end":{"line":40,"column":5}},"type":"if","locations":[{"start":{"line":38,"column":4},"end":{"line":40,"column":5}},{"start":{"line":38,"column":4},"end":{"line":40,"column":5}}],"line":38},"13":{"loc":{"start":{"line":43,"column":2},"end":{"line":49,"column":3}},"type":"if","locations":[{"start":{"line":43,"column":2},"end":{"line":49,"column":3}},{"start":{"line":43,"column":2},"end":{"line":49,"column":3}}],"line":43},"14":{"loc":{"start":{"line":45,"column":6},"end":{"line":47,"column":7}},"type":"if","locations":[{"start":{"line":45,"column":6},"end":{"line":47,"column":7}},{"start":{"line":45,"column":6},"end":{"line":47,"column":7}}],"line":45},"15":{"loc":{"start":{"line":54,"column":4},"end":{"line":65,"column":5}},"type":"if","locations":[{"start":{"line":54,"column":4},"end":{"line":65,"column":5}},{"start":{"line":54,"column":4},"end":{"line":65,"column":5}}],"line":54},"16":{"loc":{"start":{"line":55,"column":6},"end":{"line":59,"column":7}},"type":"if","locations":[{"start":{"line":55,"column":6},"end":{"line":59,"column":7}},{"start":{"line":55,"column":6},"end":{"line":59,"column":7}}],"line":55},"17":{"loc":{"start":{"line":55,"column":10},"end":{"line":57,"column":38}},"type":"binary-expr","locations":[{"start":{"line":55,"column":10},"end":{"line":55,"column":57}},{"start":{"line":56,"column":10},"end":{"line":56,"column":32}},{"start":{"line":57,"column":10},"end":{"line":57,"column":38}}],"line":55},"18":{"loc":{"start":{"line":61,"column":6},"end":{"line":64,"column":7}},"type":"if","locations":[{"start":{"line":61,"column":6},"end":{"line":64,"column":7}},{"start":{"line":61,"column":6},"end":{"line":64,"column":7}}],"line":61},"19":{"loc":{"start":{"line":61,"column":10},"end":{"line":62,"column":32}},"type":"binary-expr","locations":[{"start":{"line":61,"column":10},"end":{"line":61,"column":57}},{"start":{"line":62,"column":10},"end":{"line":62,"column":32}}],"line":61},"20":{"loc":{"start":{"line":71,"column":2},"end":{"line":78,"column":3}},"type":"if","locations":[{"start":{"line":71,"column":2},"end":{"line":78,"column":3}},{"start":{"line":71,"column":2},"end":{"line":78,"column":3}}],"line":71},"21":{"loc":{"start":{"line":71,"column":6},"end":{"line":72,"column":33}},"type":"binary-expr","locations":[{"start":{"line":71,"column":7},"end":{"line":71,"column":35}},{"start":{"line":71,"column":39},"end":{"line":71,"column":65}},{"start":{"line":72,"column":4},"end":{"line":72,"column":33}}],"line":71},"22":{"loc":{"start":{"line":74,"column":6},"end":{"line":76,"column":7}},"type":"if","locations":[{"start":{"line":74,"column":6},"end":{"line":76,"column":7}},{"start":{"line":74,"column":6},"end":{"line":76,"column":7}}],"line":74}},"s":{"0":14,"1":3,"2":11,"3":0,"4":11,"5":2,"6":9,"7":2,"8":14,"9":1,"10":13,"11":1,"12":12,"13":0,"14":12,"15":18,"16":3,"17":9,"18":7,"19":7,"20":0,"21":9,"22":14,"23":3,"24":1,"25":11,"26":2,"27":6,"28":3,"29":3,"30":3,"31":3,"32":1},"f":{"0":14,"1":14},"b":{"0":[3,11],"1":[14,5,5,12],"2":[0,11],"3":[11,5,6],"4":[2,9],"5":[11,6],"6":[2,7],"7":[9,2],"8":[1,13],"9":[14,11,1],"10":[1,12],"11":[0,12],"12":[3,15],"13":[7,2],"14":[0,7],"15":[3,11],"16":[1,2],"17":[3,2,2],"18":[2,9],"19":[11,5],"20":[3,3],"21":[6,4,3],"22":[3,0]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"27c132610be38bb15e3103f71f64451b33730473"} | ||
| ,"/Users/juretriglav/src/authsome/src/modes/noon/index.js": {"path":"/Users/juretriglav/src/authsome/src/modes/noon/index.js","statementMap":{"0":{"start":{"line":1,"column":11},"end":{"line":51,"column":1}},"1":{"start":{"line":2,"column":17},"end":{"line":2,"column":23}},"2":{"start":{"line":3,"column":19},"end":{"line":3,"column":38}},"3":{"start":{"line":5,"column":2},"end":{"line":5,"column":38}},"4":{"start":{"line":5,"column":27},"end":{"line":5,"column":38}},"5":{"start":{"line":7,"column":2},"end":{"line":13,"column":3}},"6":{"start":{"line":8,"column":4},"end":{"line":12,"column":5}},"7":{"start":{"line":9,"column":6},"end":{"line":11,"column":7}},"8":{"start":{"line":10,"column":8},"end":{"line":10,"column":19}},"9":{"start":{"line":15,"column":2},"end":{"line":21,"column":3}},"10":{"start":{"line":16,"column":4},"end":{"line":20,"column":5}},"11":{"start":{"line":17,"column":6},"end":{"line":19,"column":7}},"12":{"start":{"line":18,"column":8},"end":{"line":18,"column":19}},"13":{"start":{"line":23,"column":2},"end":{"line":49,"column":3}},"14":{"start":{"line":24,"column":4},"end":{"line":48,"column":5}},"15":{"start":{"line":25,"column":6},"end":{"line":29,"column":7}},"16":{"start":{"line":28,"column":8},"end":{"line":28,"column":19}},"17":{"start":{"line":31,"column":6},"end":{"line":35,"column":7}},"18":{"start":{"line":34,"column":8},"end":{"line":34,"column":19}},"19":{"start":{"line":37,"column":6},"end":{"line":41,"column":7}},"20":{"start":{"line":40,"column":8},"end":{"line":40,"column":19}},"21":{"start":{"line":43,"column":6},"end":{"line":47,"column":7}},"22":{"start":{"line":46,"column":8},"end":{"line":46,"column":19}},"23":{"start":{"line":50,"column":2},"end":{"line":50,"column":14}},"24":{"start":{"line":53,"column":0},"end":{"line":53,"column":21}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":1,"column":11},"end":{"line":1,"column":12}},"loc":{"start":{"line":1,"column":46},"end":{"line":51,"column":1}},"line":1}},"branchMap":{"0":{"loc":{"start":{"line":5,"column":2},"end":{"line":5,"column":38}},"type":"if","locations":[{"start":{"line":5,"column":2},"end":{"line":5,"column":38}},{"start":{"line":5,"column":2},"end":{"line":5,"column":38}}],"line":5},"1":{"loc":{"start":{"line":7,"column":2},"end":{"line":13,"column":3}},"type":"if","locations":[{"start":{"line":7,"column":2},"end":{"line":13,"column":3}},{"start":{"line":7,"column":2},"end":{"line":13,"column":3}}],"line":7},"2":{"loc":{"start":{"line":7,"column":6},"end":{"line":7,"column":54}},"type":"binary-expr","locations":[{"start":{"line":7,"column":6},"end":{"line":7,"column":28}},{"start":{"line":7,"column":32},"end":{"line":7,"column":54}}],"line":7},"3":{"loc":{"start":{"line":9,"column":6},"end":{"line":11,"column":7}},"type":"if","locations":[{"start":{"line":9,"column":6},"end":{"line":11,"column":7}},{"start":{"line":9,"column":6},"end":{"line":11,"column":7}}],"line":9},"4":{"loc":{"start":{"line":15,"column":2},"end":{"line":21,"column":3}},"type":"if","locations":[{"start":{"line":15,"column":2},"end":{"line":21,"column":3}},{"start":{"line":15,"column":2},"end":{"line":21,"column":3}}],"line":15},"5":{"loc":{"start":{"line":17,"column":6},"end":{"line":19,"column":7}},"type":"if","locations":[{"start":{"line":17,"column":6},"end":{"line":19,"column":7}},{"start":{"line":17,"column":6},"end":{"line":19,"column":7}}],"line":17},"6":{"loc":{"start":{"line":24,"column":4},"end":{"line":48,"column":5}},"type":"if","locations":[{"start":{"line":24,"column":4},"end":{"line":48,"column":5}},{"start":{"line":24,"column":4},"end":{"line":48,"column":5}}],"line":24},"7":{"loc":{"start":{"line":25,"column":6},"end":{"line":29,"column":7}},"type":"if","locations":[{"start":{"line":25,"column":6},"end":{"line":29,"column":7}},{"start":{"line":25,"column":6},"end":{"line":29,"column":7}}],"line":25},"8":{"loc":{"start":{"line":25,"column":10},"end":{"line":27,"column":32}},"type":"binary-expr","locations":[{"start":{"line":25,"column":10},"end":{"line":25,"column":45}},{"start":{"line":26,"column":10},"end":{"line":26,"column":36}},{"start":{"line":27,"column":10},"end":{"line":27,"column":32}}],"line":25},"9":{"loc":{"start":{"line":31,"column":6},"end":{"line":35,"column":7}},"type":"if","locations":[{"start":{"line":31,"column":6},"end":{"line":35,"column":7}},{"start":{"line":31,"column":6},"end":{"line":35,"column":7}}],"line":31},"10":{"loc":{"start":{"line":31,"column":10},"end":{"line":33,"column":58}},"type":"binary-expr","locations":[{"start":{"line":31,"column":10},"end":{"line":31,"column":45}},{"start":{"line":32,"column":8},"end":{"line":32,"column":32}},{"start":{"line":33,"column":9},"end":{"line":33,"column":31}},{"start":{"line":33,"column":35},"end":{"line":33,"column":57}}],"line":31},"11":{"loc":{"start":{"line":37,"column":6},"end":{"line":41,"column":7}},"type":"if","locations":[{"start":{"line":37,"column":6},"end":{"line":41,"column":7}},{"start":{"line":37,"column":6},"end":{"line":41,"column":7}}],"line":37},"12":{"loc":{"start":{"line":37,"column":10},"end":{"line":39,"column":32}},"type":"binary-expr","locations":[{"start":{"line":37,"column":10},"end":{"line":37,"column":48}},{"start":{"line":38,"column":10},"end":{"line":38,"column":36}},{"start":{"line":39,"column":10},"end":{"line":39,"column":32}}],"line":37},"13":{"loc":{"start":{"line":43,"column":6},"end":{"line":47,"column":7}},"type":"if","locations":[{"start":{"line":43,"column":6},"end":{"line":47,"column":7}},{"start":{"line":43,"column":6},"end":{"line":47,"column":7}}],"line":43},"14":{"loc":{"start":{"line":43,"column":10},"end":{"line":45,"column":32}},"type":"binary-expr","locations":[{"start":{"line":43,"column":10},"end":{"line":43,"column":48}},{"start":{"line":44,"column":10},"end":{"line":44,"column":34}},{"start":{"line":45,"column":10},"end":{"line":45,"column":32}}],"line":43}},"s":{"0":1,"1":2,"2":2,"3":2,"4":0,"5":2,"6":0,"7":0,"8":0,"9":2,"10":2,"11":2,"12":0,"13":2,"14":2,"15":1,"16":1,"17":0,"18":0,"19":0,"20":0,"21":0,"22":0,"23":1,"24":1},"f":{"0":2},"b":{"0":[0,2],"1":[0,2],"2":[2,2],"3":[0,0],"4":[2,0],"5":[0,2],"6":[1,1],"7":[1,0],"8":[1,1,1],"9":[0,0],"10":[0,0,0,0],"11":[0,0],"12":[0,0,0],"13":[0,0],"14":[0,0,0]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"bbd967787a1b265ec7bb1256d2e59fc98ca646ec"} | ||
| ,"/Users/juretriglav/src/authsome/src/modes/test/index.js": {"path":"/Users/juretriglav/src/authsome/src/modes/test/index.js","statementMap":{"0":{"start":{"line":6,"column":11},"end":{"line":49,"column":1}},"1":{"start":{"line":7,"column":2},"end":{"line":12,"column":3}},"2":{"start":{"line":8,"column":4},"end":{"line":10,"column":5}},"3":{"start":{"line":9,"column":6},"end":{"line":9,"column":17}},"4":{"start":{"line":11,"column":4},"end":{"line":11,"column":16}},"5":{"start":{"line":18,"column":2},"end":{"line":30,"column":3}},"6":{"start":{"line":19,"column":4},"end":{"line":29,"column":5}},"7":{"start":{"line":20,"column":6},"end":{"line":23,"column":7}},"8":{"start":{"line":22,"column":28},"end":{"line":22,"column":60}},"9":{"start":{"line":24,"column":11},"end":{"line":29,"column":5}},"10":{"start":{"line":25,"column":6},"end":{"line":28,"column":7}},"11":{"start":{"line":27,"column":32},"end":{"line":27,"column":44}},"12":{"start":{"line":32,"column":2},"end":{"line":34,"column":3}},"13":{"start":{"line":33,"column":4},"end":{"line":33,"column":15}},"14":{"start":{"line":36,"column":2},"end":{"line":46,"column":3}},"15":{"start":{"line":37,"column":4},"end":{"line":39,"column":5}},"16":{"start":{"line":38,"column":6},"end":{"line":38,"column":17}},"17":{"start":{"line":41,"column":4},"end":{"line":45,"column":6}},"18":{"start":{"line":42,"column":6},"end":{"line":44,"column":7}},"19":{"start":{"line":43,"column":8},"end":{"line":43,"column":19}},"20":{"start":{"line":48,"column":2},"end":{"line":48,"column":14}},"21":{"start":{"line":51,"column":0},"end":{"line":51,"column":21}}},"fnMap":{"0":{"name":"(anonymous_0)","decl":{"start":{"line":6,"column":11},"end":{"line":6,"column":12}},"loc":{"start":{"line":6,"column":55},"end":{"line":49,"column":1}},"line":6},"1":{"name":"(anonymous_1)","decl":{"start":{"line":22,"column":16},"end":{"line":22,"column":17}},"loc":{"start":{"line":22,"column":28},"end":{"line":22,"column":60}},"line":22},"2":{"name":"(anonymous_2)","decl":{"start":{"line":27,"column":16},"end":{"line":27,"column":17}},"loc":{"start":{"line":27,"column":32},"end":{"line":27,"column":44}},"line":27},"3":{"name":"(anonymous_3)","decl":{"start":{"line":41,"column":66},"end":{"line":41,"column":67}},"loc":{"start":{"line":41,"column":80},"end":{"line":45,"column":5}},"line":41}},"branchMap":{"0":{"loc":{"start":{"line":7,"column":2},"end":{"line":12,"column":3}},"type":"if","locations":[{"start":{"line":7,"column":2},"end":{"line":12,"column":3}},{"start":{"line":7,"column":2},"end":{"line":12,"column":3}}],"line":7},"1":{"loc":{"start":{"line":8,"column":4},"end":{"line":10,"column":5}},"type":"if","locations":[{"start":{"line":8,"column":4},"end":{"line":10,"column":5}},{"start":{"line":8,"column":4},"end":{"line":10,"column":5}}],"line":8},"2":{"loc":{"start":{"line":8,"column":8},"end":{"line":8,"column":44}},"type":"binary-expr","locations":[{"start":{"line":8,"column":8},"end":{"line":8,"column":27}},{"start":{"line":8,"column":31},"end":{"line":8,"column":44}}],"line":8},"3":{"loc":{"start":{"line":18,"column":2},"end":{"line":30,"column":3}},"type":"if","locations":[{"start":{"line":18,"column":2},"end":{"line":30,"column":3}},{"start":{"line":18,"column":2},"end":{"line":30,"column":3}}],"line":18},"4":{"loc":{"start":{"line":18,"column":6},"end":{"line":18,"column":34}},"type":"binary-expr","locations":[{"start":{"line":18,"column":6},"end":{"line":18,"column":10}},{"start":{"line":18,"column":14},"end":{"line":18,"column":34}}],"line":18},"5":{"loc":{"start":{"line":19,"column":4},"end":{"line":29,"column":5}},"type":"if","locations":[{"start":{"line":19,"column":4},"end":{"line":29,"column":5}},{"start":{"line":19,"column":4},"end":{"line":29,"column":5}}],"line":19},"6":{"loc":{"start":{"line":24,"column":11},"end":{"line":29,"column":5}},"type":"if","locations":[{"start":{"line":24,"column":11},"end":{"line":29,"column":5}},{"start":{"line":24,"column":11},"end":{"line":29,"column":5}}],"line":24},"7":{"loc":{"start":{"line":24,"column":15},"end":{"line":24,"column":53}},"type":"binary-expr","locations":[{"start":{"line":24,"column":15},"end":{"line":24,"column":21}},{"start":{"line":24,"column":25},"end":{"line":24,"column":53}}],"line":24},"8":{"loc":{"start":{"line":32,"column":2},"end":{"line":34,"column":3}},"type":"if","locations":[{"start":{"line":32,"column":2},"end":{"line":34,"column":3}},{"start":{"line":32,"column":2},"end":{"line":34,"column":3}}],"line":32},"9":{"loc":{"start":{"line":32,"column":6},"end":{"line":32,"column":58}},"type":"binary-expr","locations":[{"start":{"line":32,"column":6},"end":{"line":32,"column":10}},{"start":{"line":32,"column":14},"end":{"line":32,"column":23}},{"start":{"line":32,"column":27},"end":{"line":32,"column":58}}],"line":32},"10":{"loc":{"start":{"line":36,"column":2},"end":{"line":46,"column":3}},"type":"if","locations":[{"start":{"line":36,"column":2},"end":{"line":46,"column":3}},{"start":{"line":36,"column":2},"end":{"line":46,"column":3}}],"line":36},"11":{"loc":{"start":{"line":36,"column":6},"end":{"line":36,"column":44}},"type":"binary-expr","locations":[{"start":{"line":36,"column":6},"end":{"line":36,"column":10}},{"start":{"line":36,"column":14},"end":{"line":36,"column":23}},{"start":{"line":36,"column":27},"end":{"line":36,"column":33}},{"start":{"line":36,"column":37},"end":{"line":36,"column":44}}],"line":36},"12":{"loc":{"start":{"line":37,"column":4},"end":{"line":39,"column":5}},"type":"if","locations":[{"start":{"line":37,"column":4},"end":{"line":39,"column":5}},{"start":{"line":37,"column":4},"end":{"line":39,"column":5}}],"line":37},"13":{"loc":{"start":{"line":42,"column":6},"end":{"line":44,"column":7}},"type":"if","locations":[{"start":{"line":42,"column":6},"end":{"line":44,"column":7}},{"start":{"line":42,"column":6},"end":{"line":44,"column":7}}],"line":42}},"s":{"0":1,"1":7,"2":2,"3":1,"4":1,"5":5,"6":2,"7":1,"8":1,"9":1,"10":1,"11":4,"12":3,"13":1,"14":2,"15":1,"16":0,"17":1,"18":1,"19":1,"20":1,"21":1},"f":{"0":7,"1":1,"2":4,"3":1},"b":{"0":[2,5],"1":[1,1],"2":[2,1],"3":[2,3],"4":[5,5],"5":[1,1],"6":[1,0],"7":[1,1],"8":[1,2],"9":[3,3,3],"10":[1,1],"11":[2,2,2,2],"12":[0,1],"13":[1,0]},"_coverageSchema":"332fd63041d2c1bcb487cc26dd0d5f7d97098a6c","hash":"3cf9cc1ac8bed19675f7100f5f5eea6d4fd7a50a"} | ||
| } |
| body, html { | ||
| margin:0; padding: 0; | ||
| height: 100%; | ||
| } | ||
| body { | ||
| font-family: Helvetica Neue, Helvetica, Arial; | ||
| font-size: 14px; | ||
| color:#333; | ||
| } | ||
| .small { font-size: 12px; } | ||
| *, *:after, *:before { | ||
| -webkit-box-sizing:border-box; | ||
| -moz-box-sizing:border-box; | ||
| box-sizing:border-box; | ||
| } | ||
| h1 { font-size: 20px; margin: 0;} | ||
| h2 { font-size: 14px; } | ||
| pre { | ||
| font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace; | ||
| margin: 0; | ||
| padding: 0; | ||
| -moz-tab-size: 2; | ||
| -o-tab-size: 2; | ||
| tab-size: 2; | ||
| } | ||
| a { color:#0074D9; text-decoration:none; } | ||
| a:hover { text-decoration:underline; } | ||
| .strong { font-weight: bold; } | ||
| .space-top1 { padding: 10px 0 0 0; } | ||
| .pad2y { padding: 20px 0; } | ||
| .pad1y { padding: 10px 0; } | ||
| .pad2x { padding: 0 20px; } | ||
| .pad2 { padding: 20px; } | ||
| .pad1 { padding: 10px; } | ||
| .space-left2 { padding-left:55px; } | ||
| .space-right2 { padding-right:20px; } | ||
| .center { text-align:center; } | ||
| .clearfix { display:block; } | ||
| .clearfix:after { | ||
| content:''; | ||
| display:block; | ||
| height:0; | ||
| clear:both; | ||
| visibility:hidden; | ||
| } | ||
| .fl { float: left; } | ||
| @media only screen and (max-width:640px) { | ||
| .col3 { width:100%; max-width:100%; } | ||
| .hide-mobile { display:none!important; } | ||
| } | ||
| .quiet { | ||
| color: #7f7f7f; | ||
| color: rgba(0,0,0,0.5); | ||
| } | ||
| .quiet a { opacity: 0.7; } | ||
| .fraction { | ||
| font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace; | ||
| font-size: 10px; | ||
| color: #555; | ||
| background: #E8E8E8; | ||
| padding: 4px 5px; | ||
| border-radius: 3px; | ||
| vertical-align: middle; | ||
| } | ||
| div.path a:link, div.path a:visited { color: #333; } | ||
| table.coverage { | ||
| border-collapse: collapse; | ||
| margin: 10px 0 0 0; | ||
| padding: 0; | ||
| } | ||
| table.coverage td { | ||
| margin: 0; | ||
| padding: 0; | ||
| vertical-align: top; | ||
| } | ||
| table.coverage td.line-count { | ||
| text-align: right; | ||
| padding: 0 5px 0 20px; | ||
| } | ||
| table.coverage td.line-coverage { | ||
| text-align: right; | ||
| padding-right: 10px; | ||
| min-width:20px; | ||
| } | ||
| table.coverage td span.cline-any { | ||
| display: inline-block; | ||
| padding: 0 5px; | ||
| width: 100%; | ||
| } | ||
| .missing-if-branch { | ||
| display: inline-block; | ||
| margin-right: 5px; | ||
| border-radius: 3px; | ||
| position: relative; | ||
| padding: 0 4px; | ||
| background: #333; | ||
| color: yellow; | ||
| } | ||
| .skip-if-branch { | ||
| display: none; | ||
| margin-right: 10px; | ||
| position: relative; | ||
| padding: 0 4px; | ||
| background: #ccc; | ||
| color: white; | ||
| } | ||
| .missing-if-branch .typ, .skip-if-branch .typ { | ||
| color: inherit !important; | ||
| } | ||
| .coverage-summary { | ||
| border-collapse: collapse; | ||
| width: 100%; | ||
| } | ||
| .coverage-summary tr { border-bottom: 1px solid #bbb; } | ||
| .keyline-all { border: 1px solid #ddd; } | ||
| .coverage-summary td, .coverage-summary th { padding: 10px; } | ||
| .coverage-summary tbody { border: 1px solid #bbb; } | ||
| .coverage-summary td { border-right: 1px solid #bbb; } | ||
| .coverage-summary td:last-child { border-right: none; } | ||
| .coverage-summary th { | ||
| text-align: left; | ||
| font-weight: normal; | ||
| white-space: nowrap; | ||
| } | ||
| .coverage-summary th.file { border-right: none !important; } | ||
| .coverage-summary th.pct { } | ||
| .coverage-summary th.pic, | ||
| .coverage-summary th.abs, | ||
| .coverage-summary td.pct, | ||
| .coverage-summary td.abs { text-align: right; } | ||
| .coverage-summary td.file { white-space: nowrap; } | ||
| .coverage-summary td.pic { min-width: 120px !important; } | ||
| .coverage-summary tfoot td { } | ||
| .coverage-summary .sorter { | ||
| height: 10px; | ||
| width: 7px; | ||
| display: inline-block; | ||
| margin-left: 0.5em; | ||
| background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent; | ||
| } | ||
| .coverage-summary .sorted .sorter { | ||
| background-position: 0 -20px; | ||
| } | ||
| .coverage-summary .sorted-desc .sorter { | ||
| background-position: 0 -10px; | ||
| } | ||
| .status-line { height: 10px; } | ||
| /* dark red */ | ||
| .red.solid, .status-line.low, .low .cover-fill { background:#C21F39 } | ||
| .low .chart { border:1px solid #C21F39 } | ||
| /* medium red */ | ||
| .cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE } | ||
| /* light red */ | ||
| .low, .cline-no { background:#FCE1E5 } | ||
| /* light green */ | ||
| .high, .cline-yes { background:rgb(230,245,208) } | ||
| /* medium green */ | ||
| .cstat-yes { background:rgb(161,215,106) } | ||
| /* dark green */ | ||
| .status-line.high, .high .cover-fill { background:rgb(77,146,33) } | ||
| .high .chart { border:1px solid rgb(77,146,33) } | ||
| .medium .chart { border:1px solid #666; } | ||
| .medium .cover-fill { background: #666; } | ||
| .cbranch-no { background: yellow !important; color: #111; } | ||
| .cstat-skip { background: #ddd; color: #111; } | ||
| .fstat-skip { background: #ddd; color: #111 !important; } | ||
| .cbranch-skip { background: #ddd !important; color: #111; } | ||
| span.cline-neutral { background: #eaeaea; } | ||
| .medium { background: #eaeaea; } | ||
| .cover-fill, .cover-empty { | ||
| display:inline-block; | ||
| height: 12px; | ||
| } | ||
| .chart { | ||
| line-height: 0; | ||
| } | ||
| .cover-empty { | ||
| background: white; | ||
| } | ||
| .cover-full { | ||
| border-right: none !important; | ||
| } | ||
| pre.prettyprint { | ||
| border: none !important; | ||
| padding: 0 !important; | ||
| margin: 0 !important; | ||
| } | ||
| .com { color: #999 !important; } | ||
| .ignore-none { color: #999; font-weight: normal; } | ||
| .wrapper { | ||
| min-height: 100%; | ||
| height: auto !important; | ||
| height: 100%; | ||
| margin: 0 auto -48px; | ||
| } | ||
| .footer, .push { | ||
| height: 48px; | ||
| } |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for All files</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="prettify.css" /> | ||
| <link rel="stylesheet" href="base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| All files | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">76.35% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>113/148</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">74.62% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>147/197</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">77.78% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>14/18</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">77.24% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>112/145</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line medium'></div> | ||
| <div class="pad1"> | ||
| <table class="coverage-summary"> | ||
| <thead> | ||
| <tr> | ||
| <th data-col="file" data-fmt="html" data-html="true" class="file">File</th> | ||
| <th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th> | ||
| <th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th> | ||
| <th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th> | ||
| <th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th> | ||
| <th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th> | ||
| <th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| </tr> | ||
| </thead> | ||
| <tbody><tr> | ||
| <td class="file high" data-value="src"><a href="src/index.html">src</a></td> | ||
| <td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="13" class="abs high">13/13</td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="8" class="abs high">8/8</td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="2" class="abs high">2/2</td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="13" class="abs high">13/13</td> | ||
| </tr> | ||
| <tr> | ||
| <td class="file medium" data-value="src/modes/blog"><a href="src/modes/blog/index.html">src/modes/blog</a></td> | ||
| <td data-value="63.64" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 63%;"></div><div class="cover-empty" style="width:37%;"></div></div></td> | ||
| <td data-value="63.64" class="pct medium">63.64%</td> | ||
| <td data-value="55" class="abs medium">35/55</td> | ||
| <td data-value="71.83" class="pct medium">71.83%</td> | ||
| <td data-value="71" class="abs medium">51/71</td> | ||
| <td data-value="55.56" class="pct medium">55.56%</td> | ||
| <td data-value="9" class="abs medium">5/9</td> | ||
| <td data-value="62.96" class="pct medium">62.96%</td> | ||
| <td data-value="54" class="abs medium">34/54</td> | ||
| </tr> | ||
| <tr> | ||
| <td class="file high" data-value="src/modes/journal"><a href="src/modes/journal/index.html">src/modes/journal</a></td> | ||
| <td data-value="90.91" class="pic high"><div class="chart"><div class="cover-fill" style="width: 90%;"></div><div class="cover-empty" style="width:10%;"></div></div></td> | ||
| <td data-value="90.91" class="pct high">90.91%</td> | ||
| <td data-value="33" class="abs high">30/33</td> | ||
| <td data-value="92.31" class="pct high">92.31%</td> | ||
| <td data-value="52" class="abs high">48/52</td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="2" class="abs high">2/2</td> | ||
| <td data-value="93.75" class="pct high">93.75%</td> | ||
| <td data-value="32" class="abs high">30/32</td> | ||
| </tr> | ||
| <tr> | ||
| <td class="file medium" data-value="src/modes/noon"><a href="src/modes/noon/index.html">src/modes/noon</a></td> | ||
| <td data-value="56" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 56%;"></div><div class="cover-empty" style="width:44%;"></div></div></td> | ||
| <td data-value="56" class="pct medium">56%</td> | ||
| <td data-value="25" class="abs medium">14/25</td> | ||
| <td data-value="34.29" class="pct low">34.29%</td> | ||
| <td data-value="35" class="abs low">12/35</td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="1" class="abs high">1/1</td> | ||
| <td data-value="58.33" class="pct medium">58.33%</td> | ||
| <td data-value="24" class="abs medium">14/24</td> | ||
| </tr> | ||
| <tr> | ||
| <td class="file high" data-value="src/modes/test"><a href="src/modes/test/index.html">src/modes/test</a></td> | ||
| <td data-value="95.45" class="pic high"><div class="chart"><div class="cover-fill" style="width: 95%;"></div><div class="cover-empty" style="width:5%;"></div></div></td> | ||
| <td data-value="95.45" class="pct high">95.45%</td> | ||
| <td data-value="22" class="abs high">21/22</td> | ||
| <td data-value="90.32" class="pct high">90.32%</td> | ||
| <td data-value="31" class="abs high">28/31</td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="4" class="abs high">4/4</td> | ||
| <td data-value="95.45" class="pct high">95.45%</td> | ||
| <td data-value="22" class="abs high">21/22</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </div><div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:19:07 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="sorter.js"></script> | ||
| </body> | ||
| </html> |
| .pln{color:#000}@media screen{.str{color:#080}.kwd{color:#008}.com{color:#800}.typ{color:#606}.lit{color:#066}.pun,.opn,.clo{color:#660}.tag{color:#008}.atn{color:#606}.atv{color:#080}.dec,.var{color:#606}.fun{color:red}}@media print,projection{.str{color:#060}.kwd{color:#006;font-weight:bold}.com{color:#600;font-style:italic}.typ{color:#404;font-weight:bold}.lit{color:#044}.pun,.opn,.clo{color:#440}.tag{color:#006;font-weight:bold}.atn{color:#404}.atv{color:#060}}pre.prettyprint{padding:2px;border:1px solid #888}ol.linenums{margin-top:0;margin-bottom:0}li.L0,li.L1,li.L2,li.L3,li.L5,li.L6,li.L7,li.L8{list-style-type:none}li.L1,li.L3,li.L5,li.L7,li.L9{background:#eee} |
| window.PR_SHOULD_USE_CONTINUATION=true;(function(){var h=["break,continue,do,else,for,if,return,while"];var u=[h,"auto,case,char,const,default,double,enum,extern,float,goto,int,long,register,short,signed,sizeof,static,struct,switch,typedef,union,unsigned,void,volatile"];var p=[u,"catch,class,delete,false,import,new,operator,private,protected,public,this,throw,true,try,typeof"];var l=[p,"alignof,align_union,asm,axiom,bool,concept,concept_map,const_cast,constexpr,decltype,dynamic_cast,explicit,export,friend,inline,late_check,mutable,namespace,nullptr,reinterpret_cast,static_assert,static_cast,template,typeid,typename,using,virtual,where"];var x=[p,"abstract,boolean,byte,extends,final,finally,implements,import,instanceof,null,native,package,strictfp,super,synchronized,throws,transient"];var R=[x,"as,base,by,checked,decimal,delegate,descending,dynamic,event,fixed,foreach,from,group,implicit,in,interface,internal,into,is,lock,object,out,override,orderby,params,partial,readonly,ref,sbyte,sealed,stackalloc,string,select,uint,ulong,unchecked,unsafe,ushort,var"];var r="all,and,by,catch,class,else,extends,false,finally,for,if,in,is,isnt,loop,new,no,not,null,of,off,on,or,return,super,then,true,try,unless,until,when,while,yes";var w=[p,"debugger,eval,export,function,get,null,set,undefined,var,with,Infinity,NaN"];var s="caller,delete,die,do,dump,elsif,eval,exit,foreach,for,goto,if,import,last,local,my,next,no,our,print,package,redo,require,sub,undef,unless,until,use,wantarray,while,BEGIN,END";var I=[h,"and,as,assert,class,def,del,elif,except,exec,finally,from,global,import,in,is,lambda,nonlocal,not,or,pass,print,raise,try,with,yield,False,True,None"];var f=[h,"alias,and,begin,case,class,def,defined,elsif,end,ensure,false,in,module,next,nil,not,or,redo,rescue,retry,self,super,then,true,undef,unless,until,when,yield,BEGIN,END"];var H=[h,"case,done,elif,esac,eval,fi,function,in,local,set,then,until"];var A=[l,R,w,s+I,f,H];var e=/^(DIR|FILE|vector|(de|priority_)?queue|list|stack|(const_)?iterator|(multi)?(set|map)|bitset|u?(int|float)\d*)/;var C="str";var z="kwd";var j="com";var O="typ";var G="lit";var L="pun";var F="pln";var m="tag";var E="dec";var J="src";var P="atn";var n="atv";var N="nocode";var M="(?:^^\\.?|[+-]|\\!|\\!=|\\!==|\\#|\\%|\\%=|&|&&|&&=|&=|\\(|\\*|\\*=|\\+=|\\,|\\-=|\\->|\\/|\\/=|:|::|\\;|<|<<|<<=|<=|=|==|===|>|>=|>>|>>=|>>>|>>>=|\\?|\\@|\\[|\\^|\\^=|\\^\\^|\\^\\^=|\\{|\\||\\|=|\\|\\||\\|\\|=|\\~|break|case|continue|delete|do|else|finally|instanceof|return|throw|try|typeof)\\s*";function k(Z){var ad=0;var S=false;var ac=false;for(var V=0,U=Z.length;V<U;++V){var ae=Z[V];if(ae.ignoreCase){ac=true}else{if(/[a-z]/i.test(ae.source.replace(/\\u[0-9a-f]{4}|\\x[0-9a-f]{2}|\\[^ux]/gi,""))){S=true;ac=false;break}}}var Y={b:8,t:9,n:10,v:11,f:12,r:13};function ab(ah){var ag=ah.charCodeAt(0);if(ag!==92){return ag}var af=ah.charAt(1);ag=Y[af];if(ag){return ag}else{if("0"<=af&&af<="7"){return parseInt(ah.substring(1),8)}else{if(af==="u"||af==="x"){return parseInt(ah.substring(2),16)}else{return ah.charCodeAt(1)}}}}function T(af){if(af<32){return(af<16?"\\x0":"\\x")+af.toString(16)}var ag=String.fromCharCode(af);if(ag==="\\"||ag==="-"||ag==="["||ag==="]"){ag="\\"+ag}return ag}function X(am){var aq=am.substring(1,am.length-1).match(new RegExp("\\\\u[0-9A-Fa-f]{4}|\\\\x[0-9A-Fa-f]{2}|\\\\[0-3][0-7]{0,2}|\\\\[0-7]{1,2}|\\\\[\\s\\S]|-|[^-\\\\]","g"));var ak=[];var af=[];var ao=aq[0]==="^";for(var ar=ao?1:0,aj=aq.length;ar<aj;++ar){var ah=aq[ar];if(/\\[bdsw]/i.test(ah)){ak.push(ah)}else{var ag=ab(ah);var al;if(ar+2<aj&&"-"===aq[ar+1]){al=ab(aq[ar+2]);ar+=2}else{al=ag}af.push([ag,al]);if(!(al<65||ag>122)){if(!(al<65||ag>90)){af.push([Math.max(65,ag)|32,Math.min(al,90)|32])}if(!(al<97||ag>122)){af.push([Math.max(97,ag)&~32,Math.min(al,122)&~32])}}}}af.sort(function(av,au){return(av[0]-au[0])||(au[1]-av[1])});var ai=[];var ap=[NaN,NaN];for(var ar=0;ar<af.length;++ar){var at=af[ar];if(at[0]<=ap[1]+1){ap[1]=Math.max(ap[1],at[1])}else{ai.push(ap=at)}}var an=["["];if(ao){an.push("^")}an.push.apply(an,ak);for(var ar=0;ar<ai.length;++ar){var at=ai[ar];an.push(T(at[0]));if(at[1]>at[0]){if(at[1]+1>at[0]){an.push("-")}an.push(T(at[1]))}}an.push("]");return an.join("")}function W(al){var aj=al.source.match(new RegExp("(?:\\[(?:[^\\x5C\\x5D]|\\\\[\\s\\S])*\\]|\\\\u[A-Fa-f0-9]{4}|\\\\x[A-Fa-f0-9]{2}|\\\\[0-9]+|\\\\[^ux0-9]|\\(\\?[:!=]|[\\(\\)\\^]|[^\\x5B\\x5C\\(\\)\\^]+)","g"));var ah=aj.length;var an=[];for(var ak=0,am=0;ak<ah;++ak){var ag=aj[ak];if(ag==="("){++am}else{if("\\"===ag.charAt(0)){var af=+ag.substring(1);if(af&&af<=am){an[af]=-1}}}}for(var ak=1;ak<an.length;++ak){if(-1===an[ak]){an[ak]=++ad}}for(var ak=0,am=0;ak<ah;++ak){var ag=aj[ak];if(ag==="("){++am;if(an[am]===undefined){aj[ak]="(?:"}}else{if("\\"===ag.charAt(0)){var af=+ag.substring(1);if(af&&af<=am){aj[ak]="\\"+an[am]}}}}for(var ak=0,am=0;ak<ah;++ak){if("^"===aj[ak]&&"^"!==aj[ak+1]){aj[ak]=""}}if(al.ignoreCase&&S){for(var ak=0;ak<ah;++ak){var ag=aj[ak];var ai=ag.charAt(0);if(ag.length>=2&&ai==="["){aj[ak]=X(ag)}else{if(ai!=="\\"){aj[ak]=ag.replace(/[a-zA-Z]/g,function(ao){var ap=ao.charCodeAt(0);return"["+String.fromCharCode(ap&~32,ap|32)+"]"})}}}}return aj.join("")}var aa=[];for(var V=0,U=Z.length;V<U;++V){var ae=Z[V];if(ae.global||ae.multiline){throw new Error(""+ae)}aa.push("(?:"+W(ae)+")")}return new RegExp(aa.join("|"),ac?"gi":"g")}function a(V){var U=/(?:^|\s)nocode(?:\s|$)/;var X=[];var T=0;var Z=[];var W=0;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=document.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Y=S&&"pre"===S.substring(0,3);function aa(ab){switch(ab.nodeType){case 1:if(U.test(ab.className)){return}for(var ae=ab.firstChild;ae;ae=ae.nextSibling){aa(ae)}var ad=ab.nodeName;if("BR"===ad||"LI"===ad){X[W]="\n";Z[W<<1]=T++;Z[(W++<<1)|1]=ab}break;case 3:case 4:var ac=ab.nodeValue;if(ac.length){if(!Y){ac=ac.replace(/[ \t\r\n]+/g," ")}else{ac=ac.replace(/\r\n?/g,"\n")}X[W]=ac;Z[W<<1]=T;T+=ac.length;Z[(W++<<1)|1]=ab}break}}aa(V);return{sourceCode:X.join("").replace(/\n$/,""),spans:Z}}function B(S,U,W,T){if(!U){return}var V={sourceCode:U,basePos:S};W(V);T.push.apply(T,V.decorations)}var v=/\S/;function o(S){var V=undefined;for(var U=S.firstChild;U;U=U.nextSibling){var T=U.nodeType;V=(T===1)?(V?S:U):(T===3)?(v.test(U.nodeValue)?S:V):V}return V===S?undefined:V}function g(U,T){var S={};var V;(function(){var ad=U.concat(T);var ah=[];var ag={};for(var ab=0,Z=ad.length;ab<Z;++ab){var Y=ad[ab];var ac=Y[3];if(ac){for(var ae=ac.length;--ae>=0;){S[ac.charAt(ae)]=Y}}var af=Y[1];var aa=""+af;if(!ag.hasOwnProperty(aa)){ah.push(af);ag[aa]=null}}ah.push(/[\0-\uffff]/);V=k(ah)})();var X=T.length;var W=function(ah){var Z=ah.sourceCode,Y=ah.basePos;var ad=[Y,F];var af=0;var an=Z.match(V)||[];var aj={};for(var ae=0,aq=an.length;ae<aq;++ae){var ag=an[ae];var ap=aj[ag];var ai=void 0;var am;if(typeof ap==="string"){am=false}else{var aa=S[ag.charAt(0)];if(aa){ai=ag.match(aa[1]);ap=aa[0]}else{for(var ao=0;ao<X;++ao){aa=T[ao];ai=ag.match(aa[1]);if(ai){ap=aa[0];break}}if(!ai){ap=F}}am=ap.length>=5&&"lang-"===ap.substring(0,5);if(am&&!(ai&&typeof ai[1]==="string")){am=false;ap=J}if(!am){aj[ag]=ap}}var ab=af;af+=ag.length;if(!am){ad.push(Y+ab,ap)}else{var al=ai[1];var ak=ag.indexOf(al);var ac=ak+al.length;if(ai[2]){ac=ag.length-ai[2].length;ak=ac-al.length}var ar=ap.substring(5);B(Y+ab,ag.substring(0,ak),W,ad);B(Y+ab+ak,al,q(ar,al),ad);B(Y+ab+ac,ag.substring(ac),W,ad)}}ah.decorations=ad};return W}function i(T){var W=[],S=[];if(T.tripleQuotedStrings){W.push([C,/^(?:\'\'\'(?:[^\'\\]|\\[\s\S]|\'{1,2}(?=[^\']))*(?:\'\'\'|$)|\"\"\"(?:[^\"\\]|\\[\s\S]|\"{1,2}(?=[^\"]))*(?:\"\"\"|$)|\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$))/,null,"'\""])}else{if(T.multiLineStrings){W.push([C,/^(?:\'(?:[^\\\']|\\[\s\S])*(?:\'|$)|\"(?:[^\\\"]|\\[\s\S])*(?:\"|$)|\`(?:[^\\\`]|\\[\s\S])*(?:\`|$))/,null,"'\"`"])}else{W.push([C,/^(?:\'(?:[^\\\'\r\n]|\\.)*(?:\'|$)|\"(?:[^\\\"\r\n]|\\.)*(?:\"|$))/,null,"\"'"])}}if(T.verbatimStrings){S.push([C,/^@\"(?:[^\"]|\"\")*(?:\"|$)/,null])}var Y=T.hashComments;if(Y){if(T.cStyleComments){if(Y>1){W.push([j,/^#(?:##(?:[^#]|#(?!##))*(?:###|$)|.*)/,null,"#"])}else{W.push([j,/^#(?:(?:define|elif|else|endif|error|ifdef|include|ifndef|line|pragma|undef|warning)\b|[^\r\n]*)/,null,"#"])}S.push([C,/^<(?:(?:(?:\.\.\/)*|\/?)(?:[\w-]+(?:\/[\w-]+)+)?[\w-]+\.h|[a-z]\w*)>/,null])}else{W.push([j,/^#[^\r\n]*/,null,"#"])}}if(T.cStyleComments){S.push([j,/^\/\/[^\r\n]*/,null]);S.push([j,/^\/\*[\s\S]*?(?:\*\/|$)/,null])}if(T.regexLiterals){var X=("/(?=[^/*])(?:[^/\\x5B\\x5C]|\\x5C[\\s\\S]|\\x5B(?:[^\\x5C\\x5D]|\\x5C[\\s\\S])*(?:\\x5D|$))+/");S.push(["lang-regex",new RegExp("^"+M+"("+X+")")])}var V=T.types;if(V){S.push([O,V])}var U=(""+T.keywords).replace(/^ | $/g,"");if(U.length){S.push([z,new RegExp("^(?:"+U.replace(/[\s,]+/g,"|")+")\\b"),null])}W.push([F,/^\s+/,null," \r\n\t\xA0"]);S.push([G,/^@[a-z_$][a-z_$@0-9]*/i,null],[O,/^(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\w+_t\b)/,null],[F,/^[a-z_$][a-z_$@0-9]*/i,null],[G,new RegExp("^(?:0x[a-f0-9]+|(?:\\d(?:_\\d+)*\\d*(?:\\.\\d*)?|\\.\\d\\+)(?:e[+\\-]?\\d+)?)[a-z]*","i"),null,"0123456789"],[F,/^\\[\s\S]?/,null],[L,/^.[^\s\w\.$@\'\"\`\/\#\\]*/,null]);return g(W,S)}var K=i({keywords:A,hashComments:true,cStyleComments:true,multiLineStrings:true,regexLiterals:true});function Q(V,ag){var U=/(?:^|\s)nocode(?:\s|$)/;var ab=/\r\n?|\n/;var ac=V.ownerDocument;var S;if(V.currentStyle){S=V.currentStyle.whiteSpace}else{if(window.getComputedStyle){S=ac.defaultView.getComputedStyle(V,null).getPropertyValue("white-space")}}var Z=S&&"pre"===S.substring(0,3);var af=ac.createElement("LI");while(V.firstChild){af.appendChild(V.firstChild)}var W=[af];function ae(al){switch(al.nodeType){case 1:if(U.test(al.className)){break}if("BR"===al.nodeName){ad(al);if(al.parentNode){al.parentNode.removeChild(al)}}else{for(var an=al.firstChild;an;an=an.nextSibling){ae(an)}}break;case 3:case 4:if(Z){var am=al.nodeValue;var aj=am.match(ab);if(aj){var ai=am.substring(0,aj.index);al.nodeValue=ai;var ah=am.substring(aj.index+aj[0].length);if(ah){var ak=al.parentNode;ak.insertBefore(ac.createTextNode(ah),al.nextSibling)}ad(al);if(!ai){al.parentNode.removeChild(al)}}}break}}function ad(ak){while(!ak.nextSibling){ak=ak.parentNode;if(!ak){return}}function ai(al,ar){var aq=ar?al.cloneNode(false):al;var ao=al.parentNode;if(ao){var ap=ai(ao,1);var an=al.nextSibling;ap.appendChild(aq);for(var am=an;am;am=an){an=am.nextSibling;ap.appendChild(am)}}return aq}var ah=ai(ak.nextSibling,0);for(var aj;(aj=ah.parentNode)&&aj.nodeType===1;){ah=aj}W.push(ah)}for(var Y=0;Y<W.length;++Y){ae(W[Y])}if(ag===(ag|0)){W[0].setAttribute("value",ag)}var aa=ac.createElement("OL");aa.className="linenums";var X=Math.max(0,((ag-1))|0)||0;for(var Y=0,T=W.length;Y<T;++Y){af=W[Y];af.className="L"+((Y+X)%10);if(!af.firstChild){af.appendChild(ac.createTextNode("\xA0"))}aa.appendChild(af)}V.appendChild(aa)}function D(ac){var aj=/\bMSIE\b/.test(navigator.userAgent);var am=/\n/g;var al=ac.sourceCode;var an=al.length;var V=0;var aa=ac.spans;var T=aa.length;var ah=0;var X=ac.decorations;var Y=X.length;var Z=0;X[Y]=an;var ar,aq;for(aq=ar=0;aq<Y;){if(X[aq]!==X[aq+2]){X[ar++]=X[aq++];X[ar++]=X[aq++]}else{aq+=2}}Y=ar;for(aq=ar=0;aq<Y;){var at=X[aq];var ab=X[aq+1];var W=aq+2;while(W+2<=Y&&X[W+1]===ab){W+=2}X[ar++]=at;X[ar++]=ab;aq=W}Y=X.length=ar;var ae=null;while(ah<T){var af=aa[ah];var S=aa[ah+2]||an;var ag=X[Z];var ap=X[Z+2]||an;var W=Math.min(S,ap);var ak=aa[ah+1];var U;if(ak.nodeType!==1&&(U=al.substring(V,W))){if(aj){U=U.replace(am,"\r")}ak.nodeValue=U;var ai=ak.ownerDocument;var ao=ai.createElement("SPAN");ao.className=X[Z+1];var ad=ak.parentNode;ad.replaceChild(ao,ak);ao.appendChild(ak);if(V<S){aa[ah+1]=ak=ai.createTextNode(al.substring(W,S));ad.insertBefore(ak,ao.nextSibling)}}V=W;if(V>=S){ah+=2}if(V>=ap){Z+=2}}}var t={};function c(U,V){for(var S=V.length;--S>=0;){var T=V[S];if(!t.hasOwnProperty(T)){t[T]=U}else{if(window.console){console.warn("cannot override language handler %s",T)}}}}function q(T,S){if(!(T&&t.hasOwnProperty(T))){T=/^\s*</.test(S)?"default-markup":"default-code"}return t[T]}c(K,["default-code"]);c(g([],[[F,/^[^<?]+/],[E,/^<!\w[^>]*(?:>|$)/],[j,/^<\!--[\s\S]*?(?:-\->|$)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],[L,/^(?:<[%?]|[%?]>)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i]]),["default-markup","htm","html","mxml","xhtml","xml","xsl"]);c(g([[F,/^[\s]+/,null," \t\r\n"],[n,/^(?:\"[^\"]*\"?|\'[^\']*\'?)/,null,"\"'"]],[[m,/^^<\/?[a-z](?:[\w.:-]*\w)?|\/?>$/i],[P,/^(?!style[\s=]|on)[a-z](?:[\w:-]*\w)?/i],["lang-uq.val",/^=\s*([^>\'\"\s]*(?:[^>\'\"\s\/]|\/(?=\s)))/],[L,/^[=<>\/]+/],["lang-js",/^on\w+\s*=\s*\"([^\"]+)\"/i],["lang-js",/^on\w+\s*=\s*\'([^\']+)\'/i],["lang-js",/^on\w+\s*=\s*([^\"\'>\s]+)/i],["lang-css",/^style\s*=\s*\"([^\"]+)\"/i],["lang-css",/^style\s*=\s*\'([^\']+)\'/i],["lang-css",/^style\s*=\s*([^\"\'>\s]+)/i]]),["in.tag"]);c(g([],[[n,/^[\s\S]+/]]),["uq.val"]);c(i({keywords:l,hashComments:true,cStyleComments:true,types:e}),["c","cc","cpp","cxx","cyc","m"]);c(i({keywords:"null,true,false"}),["json"]);c(i({keywords:R,hashComments:true,cStyleComments:true,verbatimStrings:true,types:e}),["cs"]);c(i({keywords:x,cStyleComments:true}),["java"]);c(i({keywords:H,hashComments:true,multiLineStrings:true}),["bsh","csh","sh"]);c(i({keywords:I,hashComments:true,multiLineStrings:true,tripleQuotedStrings:true}),["cv","py"]);c(i({keywords:s,hashComments:true,multiLineStrings:true,regexLiterals:true}),["perl","pl","pm"]);c(i({keywords:f,hashComments:true,multiLineStrings:true,regexLiterals:true}),["rb"]);c(i({keywords:w,cStyleComments:true,regexLiterals:true}),["js"]);c(i({keywords:r,hashComments:3,cStyleComments:true,multilineStrings:true,tripleQuotedStrings:true,regexLiterals:true}),["coffee"]);c(g([],[[C,/^[\s\S]+/]]),["regex"]);function d(V){var U=V.langExtension;try{var S=a(V.sourceNode);var T=S.sourceCode;V.sourceCode=T;V.spans=S.spans;V.basePos=0;q(U,T)(V);D(V)}catch(W){if("console" in window){console.log(W&&W.stack?W.stack:W)}}}function y(W,V,U){var S=document.createElement("PRE");S.innerHTML=W;if(U){Q(S,U)}var T={langExtension:V,numberLines:U,sourceNode:S};d(T);return S.innerHTML}function b(ad){function Y(af){return document.getElementsByTagName(af)}var ac=[Y("pre"),Y("code"),Y("xmp")];var T=[];for(var aa=0;aa<ac.length;++aa){for(var Z=0,V=ac[aa].length;Z<V;++Z){T.push(ac[aa][Z])}}ac=null;var W=Date;if(!W.now){W={now:function(){return +(new Date)}}}var X=0;var S;var ab=/\blang(?:uage)?-([\w.]+)(?!\S)/;var ae=/\bprettyprint\b/;function U(){var ag=(window.PR_SHOULD_USE_CONTINUATION?W.now()+250:Infinity);for(;X<T.length&&W.now()<ag;X++){var aj=T[X];var ai=aj.className;if(ai.indexOf("prettyprint")>=0){var ah=ai.match(ab);var am;if(!ah&&(am=o(aj))&&"CODE"===am.tagName){ah=am.className.match(ab)}if(ah){ah=ah[1]}var al=false;for(var ak=aj.parentNode;ak;ak=ak.parentNode){if((ak.tagName==="pre"||ak.tagName==="code"||ak.tagName==="xmp")&&ak.className&&ak.className.indexOf("prettyprint")>=0){al=true;break}}if(!al){var af=aj.className.match(/\blinenums\b(?::(\d+))?/);af=af?af[1]&&af[1].length?+af[1]:true:false;if(af){Q(aj,af)}S={langExtension:ah,sourceNode:aj,numberLines:af};d(S)}}}if(X<T.length){setTimeout(U,250)}else{if(ad){ad()}}}U()}window.prettyPrintOne=y;window.prettyPrint=b;window.PR={createSimpleLexer:g,registerLangHandler:c,sourceDecorator:i,PR_ATTRIB_NAME:P,PR_ATTRIB_VALUE:n,PR_COMMENT:j,PR_DECLARATION:E,PR_KEYWORD:z,PR_LITERAL:G,PR_NOCODE:N,PR_PLAIN:F,PR_PUNCTUATION:L,PR_SOURCE:J,PR_STRING:C,PR_TAG:m,PR_TYPE:O}})();PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_DECLARATION,/^<!\w[^>]*(?:>|$)/],[PR.PR_COMMENT,/^<\!--[\s\S]*?(?:-\->|$)/],[PR.PR_PUNCTUATION,/^(?:<[%?]|[%?]>)/],["lang-",/^<\?([\s\S]+?)(?:\?>|$)/],["lang-",/^<%([\s\S]+?)(?:%>|$)/],["lang-",/^<xmp\b[^>]*>([\s\S]+?)<\/xmp\b[^>]*>/i],["lang-handlebars",/^<script\b[^>]*type\s*=\s*['"]?text\/x-handlebars-template['"]?\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-js",/^<script\b[^>]*>([\s\S]*?)(<\/script\b[^>]*>)/i],["lang-css",/^<style\b[^>]*>([\s\S]*?)(<\/style\b[^>]*>)/i],["lang-in.tag",/^(<\/?[a-z][^<>]*>)/i],[PR.PR_DECLARATION,/^{{[#^>/]?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{&?\s*[\w.][^}]*}}/],[PR.PR_DECLARATION,/^{{{>?\s*[\w.][^}]*}}}/],[PR.PR_COMMENT,/^{{![^}]*}}/]]),["handlebars","hbs"]);PR.registerLangHandler(PR.createSimpleLexer([[PR.PR_PLAIN,/^[ \t\r\n\f]+/,null," \t\r\n\f"]],[[PR.PR_STRING,/^\"(?:[^\n\r\f\\\"]|\\(?:\r\n?|\n|\f)|\\[\s\S])*\"/,null],[PR.PR_STRING,/^\'(?:[^\n\r\f\\\']|\\(?:\r\n?|\n|\f)|\\[\s\S])*\'/,null],["lang-css-str",/^url\(([^\)\"\']*)\)/i],[PR.PR_KEYWORD,/^(?:url|rgb|\!important|@import|@page|@media|@charset|inherit)(?=[^\-\w]|$)/i,null],["lang-css-kw",/^(-?(?:[_a-z]|(?:\\[0-9a-f]+ ?))(?:[_a-z0-9\-]|\\(?:\\[0-9a-f]+ ?))*)\s*:/i],[PR.PR_COMMENT,/^\/\*[^*]*\*+(?:[^\/*][^*]*\*+)*\//],[PR.PR_COMMENT,/^(?:<!--|-->)/],[PR.PR_LITERAL,/^(?:\d+|\d*\.\d+)(?:%|[a-z]+)?/i],[PR.PR_LITERAL,/^#(?:[0-9a-f]{3}){1,2}/i],[PR.PR_PLAIN,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i],[PR.PR_PUNCTUATION,/^[^\s\w\'\"]+/]]),["css"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_KEYWORD,/^-?(?:[_a-z]|(?:\\[\da-f]+ ?))(?:[_a-z\d\-]|\\(?:\\[\da-f]+ ?))*/i]]),["css-kw"]);PR.registerLangHandler(PR.createSimpleLexer([],[[PR.PR_STRING,/^[^\)\"\']+/]]),["css-str"]); |
Sorry, the diff of this file is not supported yet
| var addSorting = (function () { | ||
| "use strict"; | ||
| var cols, | ||
| currentSort = { | ||
| index: 0, | ||
| desc: false | ||
| }; | ||
| // returns the summary table element | ||
| function getTable() { return document.querySelector('.coverage-summary'); } | ||
| // returns the thead element of the summary table | ||
| function getTableHeader() { return getTable().querySelector('thead tr'); } | ||
| // returns the tbody element of the summary table | ||
| function getTableBody() { return getTable().querySelector('tbody'); } | ||
| // returns the th element for nth column | ||
| function getNthColumn(n) { return getTableHeader().querySelectorAll('th')[n]; } | ||
| // loads all columns | ||
| function loadColumns() { | ||
| var colNodes = getTableHeader().querySelectorAll('th'), | ||
| colNode, | ||
| cols = [], | ||
| col, | ||
| i; | ||
| for (i = 0; i < colNodes.length; i += 1) { | ||
| colNode = colNodes[i]; | ||
| col = { | ||
| key: colNode.getAttribute('data-col'), | ||
| sortable: !colNode.getAttribute('data-nosort'), | ||
| type: colNode.getAttribute('data-type') || 'string' | ||
| }; | ||
| cols.push(col); | ||
| if (col.sortable) { | ||
| col.defaultDescSort = col.type === 'number'; | ||
| colNode.innerHTML = colNode.innerHTML + '<span class="sorter"></span>'; | ||
| } | ||
| } | ||
| return cols; | ||
| } | ||
| // attaches a data attribute to every tr element with an object | ||
| // of data values keyed by column name | ||
| function loadRowData(tableRow) { | ||
| var tableCols = tableRow.querySelectorAll('td'), | ||
| colNode, | ||
| col, | ||
| data = {}, | ||
| i, | ||
| val; | ||
| for (i = 0; i < tableCols.length; i += 1) { | ||
| colNode = tableCols[i]; | ||
| col = cols[i]; | ||
| val = colNode.getAttribute('data-value'); | ||
| if (col.type === 'number') { | ||
| val = Number(val); | ||
| } | ||
| data[col.key] = val; | ||
| } | ||
| return data; | ||
| } | ||
| // loads all row data | ||
| function loadData() { | ||
| var rows = getTableBody().querySelectorAll('tr'), | ||
| i; | ||
| for (i = 0; i < rows.length; i += 1) { | ||
| rows[i].data = loadRowData(rows[i]); | ||
| } | ||
| } | ||
| // sorts the table using the data for the ith column | ||
| function sortByIndex(index, desc) { | ||
| var key = cols[index].key, | ||
| sorter = function (a, b) { | ||
| a = a.data[key]; | ||
| b = b.data[key]; | ||
| return a < b ? -1 : a > b ? 1 : 0; | ||
| }, | ||
| finalSorter = sorter, | ||
| tableBody = document.querySelector('.coverage-summary tbody'), | ||
| rowNodes = tableBody.querySelectorAll('tr'), | ||
| rows = [], | ||
| i; | ||
| if (desc) { | ||
| finalSorter = function (a, b) { | ||
| return -1 * sorter(a, b); | ||
| }; | ||
| } | ||
| for (i = 0; i < rowNodes.length; i += 1) { | ||
| rows.push(rowNodes[i]); | ||
| tableBody.removeChild(rowNodes[i]); | ||
| } | ||
| rows.sort(finalSorter); | ||
| for (i = 0; i < rows.length; i += 1) { | ||
| tableBody.appendChild(rows[i]); | ||
| } | ||
| } | ||
| // removes sort indicators for current column being sorted | ||
| function removeSortIndicators() { | ||
| var col = getNthColumn(currentSort.index), | ||
| cls = col.className; | ||
| cls = cls.replace(/ sorted$/, '').replace(/ sorted-desc$/, ''); | ||
| col.className = cls; | ||
| } | ||
| // adds sort indicators for current column being sorted | ||
| function addSortIndicators() { | ||
| getNthColumn(currentSort.index).className += currentSort.desc ? ' sorted-desc' : ' sorted'; | ||
| } | ||
| // adds event listeners for all sorter widgets | ||
| function enableUI() { | ||
| var i, | ||
| el, | ||
| ithSorter = function ithSorter(i) { | ||
| var col = cols[i]; | ||
| return function () { | ||
| var desc = col.defaultDescSort; | ||
| if (currentSort.index === i) { | ||
| desc = !currentSort.desc; | ||
| } | ||
| sortByIndex(i, desc); | ||
| removeSortIndicators(); | ||
| currentSort.index = i; | ||
| currentSort.desc = desc; | ||
| addSortIndicators(); | ||
| }; | ||
| }; | ||
| for (i =0 ; i < cols.length; i += 1) { | ||
| if (cols[i].sortable) { | ||
| // add the click event handler on the th so users | ||
| // dont have to click on those tiny arrows | ||
| el = getNthColumn(i).querySelector('.sorter').parentElement; | ||
| if (el.addEventListener) { | ||
| el.addEventListener('click', ithSorter(i)); | ||
| } else { | ||
| el.attachEvent('onclick', ithSorter(i)); | ||
| } | ||
| } | ||
| } | ||
| } | ||
| // adds sorting functionality to the UI | ||
| return function () { | ||
| if (!getTable()) { | ||
| return; | ||
| } | ||
| cols = loadColumns(); | ||
| loadData(cols); | ||
| addSortIndicators(); | ||
| enableUI(); | ||
| }; | ||
| })(); | ||
| window.addEventListener('load', addSorting); |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/authsome_test.js</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../prettify.css" /> | ||
| <link rel="stylesheet" href="../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../index.html">All files</a> / <a href="index.html">src</a> authsome_test.js | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>0/14</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>0/0</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>0/6</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>0/13</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line low'></div> | ||
| <pre><table class="coverage"> | ||
| <tr><td class="line-count quiet">1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 | ||
| 22</td><td class="line-coverage quiet"><span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">const Authsome = <span class="cstat-no" title="statement not covered" >require('.')</span> | ||
| | ||
| <span class="cstat-no" title="statement not covered" >describe('Authsome', <span class="fstat-no" title="function not covered" >()</span> => {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('defaults to freefornone for no mode', <span class="fstat-no" title="function not covered" >()</span> => {</span> | ||
| const auth = <span class="cstat-no" title="statement not covered" >new Authsome()</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(auth.mode).toBe('freefornone')</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('accepts mode as function', <span class="fstat-no" title="function not covered" >()</span> => {</span> | ||
| const myMode = <span class="cstat-no" title="statement not covered" ><span class="fstat-no" title="function not covered" >()</span> => <span class="cstat-no" title="statement not covered" >false</span></span> | ||
| const auth = <span class="cstat-no" title="statement not covered" >new Authsome({mode: myMode})</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(auth.mode).toBe(myMode)</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('freefornone mode', <span class="fstat-no" title="function not covered" >()</span> => {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('always returns false', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| const auth = <span class="cstat-no" title="statement not covered" >new Authsome()</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(await auth.can()).toBe(false)</span> | ||
| }) | ||
| }) | ||
| }) | ||
| </pre></td></tr> | ||
| </table></pre> | ||
| <div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 11:57:18 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../prettify.css" /> | ||
| <link rel="stylesheet" href="../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../index.html">All files</a> src | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>13/13</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>8/8</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>2/2</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>13/13</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line high'></div> | ||
| <div class="pad1"> | ||
| <table class="coverage-summary"> | ||
| <thead> | ||
| <tr> | ||
| <th data-col="file" data-fmt="html" data-html="true" class="file">File</th> | ||
| <th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th> | ||
| <th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th> | ||
| <th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th> | ||
| <th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th> | ||
| <th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th> | ||
| <th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| </tr> | ||
| </thead> | ||
| <tbody><tr> | ||
| <td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td> | ||
| <td data-value="100" class="pic high"><div class="chart"><div class="cover-fill cover-full" style="width: 100%;"></div><div class="cover-empty" style="width:0%;"></div></div></td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="13" class="abs high">13/13</td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="8" class="abs high">8/8</td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="2" class="abs high">2/2</td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="13" class="abs high">13/13</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </div><div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:19:07 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/index.js</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../prettify.css" /> | ||
| <link rel="stylesheet" href="../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../index.html">All files</a> / <a href="index.html">src</a> index.js | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>13/13</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>8/8</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>2/2</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>13/13</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line high'></div> | ||
| <pre><table class="coverage"> | ||
| <tr><td class="line-count quiet">1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 | ||
| 22 | ||
| 23 | ||
| 24 | ||
| 25 | ||
| 26 | ||
| 27 | ||
| 28 | ||
| 29 | ||
| 30 | ||
| 31 | ||
| 32 | ||
| 33 | ||
| 34 | ||
| 35 | ||
| 36 | ||
| 37 | ||
| 38 | ||
| 39 | ||
| 40 | ||
| 41 | ||
| 42 | ||
| 43 | ||
| 44 | ||
| 45 | ||
| 46 | ||
| 47 | ||
| 48 | ||
| 49 | ||
| 50 | ||
| 51 | ||
| 52 | ||
| 53 | ||
| 54 | ||
| 55</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">8x</span> | ||
| <span class="cline-any cline-yes">6x</span> | ||
| <span class="cline-any cline-yes">6x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">8x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">8x</span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">30x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">29x</span> | ||
| <span class="cline-any cline-yes">29x</span> | ||
| <span class="cline-any cline-yes">29x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">5x</span> | ||
| <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">'use strict' | ||
| | ||
| // Config is used to provide mode name and team configuration, e.g.: | ||
| // | ||
| // const blogmode = require('authsome/src/modes/blog') | ||
| // authsome: { | ||
| // mode: blogmode, | ||
| // teams: { | ||
| // teamContributors: { | ||
| // name: 'Contributors', | ||
| // permissions: 'create' | ||
| // }, | ||
| // teamCoauthors: { | ||
| // name: 'Coauthors', | ||
| // permissions: 'update' | ||
| // } | ||
| // } | ||
| // } | ||
| // | ||
| // Context can be used to supply additional information about | ||
| // the authorization request. For example, you can use it to supply | ||
| // information about the model system to the authorization system, e.g.: | ||
| // | ||
| // let authsome = new Authsome(config.authsome, { | ||
| // models: require('../models') | ||
| // }) | ||
| | ||
| class Authsome { | ||
| constructor (config, context) { | ||
| if (config) { | ||
| this.mode = config.mode | ||
| this.teams = config.teams | ||
| } | ||
| | ||
| this.context = context | ||
| | ||
| if (!this.mode) { | ||
| this.mode = 'freefornone' | ||
| this.teams = undefined | ||
| } | ||
| } | ||
| | ||
| can (user, operation, object) { | ||
| if (this.mode === 'freefornone') { | ||
| return Promise.resolve(false) | ||
| } else { | ||
| let result = this.mode(user, operation, object, this.context) | ||
| let isPromise = typeof result.then === 'function' | ||
| return isPromise ? result : Promise.resolve(result) | ||
| } | ||
| } | ||
| } | ||
| | ||
| module.exports = Authsome | ||
| </pre></td></tr> | ||
| </table></pre> | ||
| <div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:19:07 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/modes/blog/blog_test.js</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../../../prettify.css" /> | ||
| <link rel="stylesheet" href="../../../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../../../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../../../index.html">All files</a> / <a href="index.html">src/modes/blog</a> blog_test.js | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>0/45</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>0/0</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>0/14</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>0/45</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line low'></div> | ||
| <pre><table class="coverage"> | ||
| <tr><td class="line-count quiet">1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 | ||
| 22 | ||
| 23 | ||
| 24 | ||
| 25 | ||
| 26 | ||
| 27 | ||
| 28 | ||
| 29 | ||
| 30 | ||
| 31 | ||
| 32 | ||
| 33 | ||
| 34 | ||
| 35 | ||
| 36 | ||
| 37 | ||
| 38 | ||
| 39 | ||
| 40 | ||
| 41 | ||
| 42 | ||
| 43 | ||
| 44 | ||
| 45 | ||
| 46 | ||
| 47 | ||
| 48 | ||
| 49 | ||
| 50 | ||
| 51 | ||
| 52 | ||
| 53 | ||
| 54 | ||
| 55 | ||
| 56 | ||
| 57 | ||
| 58 | ||
| 59 | ||
| 60 | ||
| 61 | ||
| 62 | ||
| 63 | ||
| 64 | ||
| 65 | ||
| 66 | ||
| 67 | ||
| 68 | ||
| 69 | ||
| 70 | ||
| 71 | ||
| 72 | ||
| 73 | ||
| 74 | ||
| 75 | ||
| 76 | ||
| 77 | ||
| 78 | ||
| 79 | ||
| 80 | ||
| 81 | ||
| 82 | ||
| 83 | ||
| 84 | ||
| 85 | ||
| 86 | ||
| 87 | ||
| 88 | ||
| 89 | ||
| 90 | ||
| 91 | ||
| 92 | ||
| 93 | ||
| 94 | ||
| 95 | ||
| 96 | ||
| 97 | ||
| 98 | ||
| 99 | ||
| 100 | ||
| 101 | ||
| 102 | ||
| 103 | ||
| 104 | ||
| 105 | ||
| 106 | ||
| 107 | ||
| 108 | ||
| 109 | ||
| 110 | ||
| 111 | ||
| 112 | ||
| 113 | ||
| 114 | ||
| 115 | ||
| 116 | ||
| 117 | ||
| 118 | ||
| 119 | ||
| 120 | ||
| 121 | ||
| 122 | ||
| 123 | ||
| 124 | ||
| 125 | ||
| 126 | ||
| 127 | ||
| 128 | ||
| 129 | ||
| 130 | ||
| 131 | ||
| 132 | ||
| 133 | ||
| 134 | ||
| 135 | ||
| 136 | ||
| 137 | ||
| 138 | ||
| 139 | ||
| 140</td><td class="line-coverage quiet"><span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">const Authsome = <span class="cstat-no" title="statement not covered" >require('../../../src')</span> | ||
| const blog = <span class="cstat-no" title="statement not covered" >require('../blog')</span> | ||
| | ||
| // CREATE UPDATE DELETE | ||
| | ||
| let admin = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_1', | ||
| name: 'Admin user', | ||
| admin: true, | ||
| type: 'user' | ||
| } | ||
| | ||
| let collection = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'collection_1', | ||
| name: 'Blog', | ||
| owners: [admin.id], | ||
| type: 'collection' | ||
| } | ||
| | ||
| let teams = <span class="cstat-no" title="statement not covered" >{</span> | ||
| teamContributors: { | ||
| name: 'Contributors', | ||
| permissions: 'POST' | ||
| }, | ||
| teamCoauthors: { | ||
| name: 'Coauthors', | ||
| permissions: 'PATCH' | ||
| } | ||
| } | ||
| | ||
| let teamContributors = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'team_1', | ||
| object: collection, | ||
| type: 'team', | ||
| teamType: teams.teamContributors | ||
| } | ||
| | ||
| let user2 = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_2', | ||
| name: 'User One', | ||
| teams: [teamContributors], | ||
| type: 'user' | ||
| } | ||
| | ||
| let fragment = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'fragment_1', | ||
| title: 'Post', | ||
| owners: [user2.id], | ||
| parents: [collection], | ||
| type: 'fragment' | ||
| } | ||
| | ||
| let teamCoauthors = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'team_2', | ||
| object: fragment, | ||
| type: 'team', | ||
| teamType: teams.teamCoauthors | ||
| } | ||
| | ||
| let user3 = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_3', | ||
| name: 'User Two', | ||
| teams: [teamCoauthors], | ||
| type: 'user' | ||
| } | ||
| | ||
| let fragment2 = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'fragment_2', | ||
| title: 'Post', | ||
| owners: [user3.id], | ||
| parents: [collection], | ||
| type: 'fragment' | ||
| } | ||
| | ||
| let fragment3 = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'fragment_2', | ||
| title: 'Post', | ||
| owners: [user3.id], | ||
| parents: [collection], | ||
| type: 'fragment', | ||
| published: true | ||
| } | ||
| | ||
| const authsome = <span class="cstat-no" title="statement not covered" >new Authsome({mode: blog, teams: teams})</span> | ||
| | ||
| <span class="cstat-no" title="statement not covered" >describe('Blog mode', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > describe('admin', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to delete fragments owned by someone else', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(admin, 'DELETE', fragment)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).toBe(true)</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to create fragments', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(admin, 'POST', fragment)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).toBe(true)</span> | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('member of team contributors', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to create fragments', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(user2, 'POST', fragment)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).toBe(true)</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should not be able to delete fragments which are owned by someone else', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(user2, 'POST', fragment)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).toBe(true)</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to update fragments owned by them', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(user2, 'PATCH', fragment)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).toBe(true)</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should not be able to update fragments owned by other users', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(user2, 'PATCH', fragment2)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).toBe(false)</span> | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('member of team coauthors', <span class="fstat-no" title="function not covered" >()</span> => {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to update the fragment', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(user3, 'PATCH', fragment)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).toBe(true)</span> | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('member of public', <span class="fstat-no" title="function not covered" >()</span> => {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to access published fragments', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| const permission = <span class="cstat-no" title="statement not covered" >await authsome.can(null, 'GET', fragment3)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission.filter).toBeTruthy()</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should not be able to accessed unpublished fragments', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| const permission = <span class="cstat-no" title="statement not covered" >await authsome.can(null, 'GET', fragment)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).toBe(false)</span> | ||
| }) | ||
| }) | ||
| }) | ||
| </pre></td></tr> | ||
| </table></pre> | ||
| <div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:02:08 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../../../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../../../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/modes/blog</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../../../prettify.css" /> | ||
| <link rel="stylesheet" href="../../../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../../../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../../../index.html">All files</a> src/modes/blog | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">63.64% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>35/55</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">71.83% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>51/71</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">55.56% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>5/9</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">62.96% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>34/54</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line medium'></div> | ||
| <div class="pad1"> | ||
| <table class="coverage-summary"> | ||
| <thead> | ||
| <tr> | ||
| <th data-col="file" data-fmt="html" data-html="true" class="file">File</th> | ||
| <th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th> | ||
| <th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th> | ||
| <th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th> | ||
| <th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th> | ||
| <th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th> | ||
| <th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| </tr> | ||
| </thead> | ||
| <tbody><tr> | ||
| <td class="file medium" data-value="index.js"><a href="index.js.html">index.js</a></td> | ||
| <td data-value="63.64" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 63%;"></div><div class="cover-empty" style="width:37%;"></div></div></td> | ||
| <td data-value="63.64" class="pct medium">63.64%</td> | ||
| <td data-value="55" class="abs medium">35/55</td> | ||
| <td data-value="71.83" class="pct medium">71.83%</td> | ||
| <td data-value="71" class="abs medium">51/71</td> | ||
| <td data-value="55.56" class="pct medium">55.56%</td> | ||
| <td data-value="9" class="abs medium">5/9</td> | ||
| <td data-value="62.96" class="pct medium">62.96%</td> | ||
| <td data-value="54" class="abs medium">34/54</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </div><div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:19:07 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../../../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../../../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/modes/blog/index.js</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../../../prettify.css" /> | ||
| <link rel="stylesheet" href="../../../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../../../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../../../index.html">All files</a> / <a href="index.html">src/modes/blog</a> index.js | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">63.64% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>35/55</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">71.83% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>51/71</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">55.56% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>5/9</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">62.96% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>34/54</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line medium'></div> | ||
| <pre><table class="coverage"> | ||
| <tr><td class="line-count quiet">1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 | ||
| 22 | ||
| 23 | ||
| 24 | ||
| 25 | ||
| 26 | ||
| 27 | ||
| 28 | ||
| 29 | ||
| 30 | ||
| 31 | ||
| 32 | ||
| 33 | ||
| 34 | ||
| 35 | ||
| 36 | ||
| 37 | ||
| 38 | ||
| 39 | ||
| 40 | ||
| 41 | ||
| 42 | ||
| 43 | ||
| 44 | ||
| 45 | ||
| 46 | ||
| 47 | ||
| 48 | ||
| 49 | ||
| 50 | ||
| 51 | ||
| 52 | ||
| 53 | ||
| 54 | ||
| 55 | ||
| 56 | ||
| 57 | ||
| 58 | ||
| 59 | ||
| 60 | ||
| 61 | ||
| 62 | ||
| 63 | ||
| 64 | ||
| 65 | ||
| 66 | ||
| 67 | ||
| 68 | ||
| 69 | ||
| 70 | ||
| 71 | ||
| 72 | ||
| 73 | ||
| 74 | ||
| 75 | ||
| 76 | ||
| 77 | ||
| 78 | ||
| 79 | ||
| 80 | ||
| 81 | ||
| 82 | ||
| 83 | ||
| 84 | ||
| 85 | ||
| 86 | ||
| 87 | ||
| 88 | ||
| 89 | ||
| 90 | ||
| 91 | ||
| 92 | ||
| 93 | ||
| 94 | ||
| 95 | ||
| 96 | ||
| 97 | ||
| 98 | ||
| 99 | ||
| 100 | ||
| 101 | ||
| 102 | ||
| 103 | ||
| 104 | ||
| 105 | ||
| 106 | ||
| 107 | ||
| 108 | ||
| 109 | ||
| 110 | ||
| 111 | ||
| 112 | ||
| 113 | ||
| 114 | ||
| 115 | ||
| 116 | ||
| 117</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">5x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">5x</span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">5x</span> | ||
| <span class="cline-any cline-yes">5x</span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">9x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">7x</span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">5x</span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">5x</span> | ||
| <span class="cline-any cline-yes">5x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">5x</span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">5x</span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">function isPublished (fragment) { | ||
| return fragment.published | ||
| } | ||
| | ||
| function isOwner (user, object) { | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (!object || !object.owners || !user) { | ||
| <span class="cstat-no" title="statement not covered" > return false</span> | ||
| } | ||
| | ||
| for (const ownerId of object.owners) { | ||
| if (ownerId === user.id) { | ||
| return true | ||
| } | ||
| } | ||
| } | ||
| | ||
| function teamPermissions (user, operation, object) { | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (!user || !Array.isArray(user.teams)) { | ||
| <span class="cstat-no" title="statement not covered" > return false</span> | ||
| } | ||
| | ||
| for (const team of user.teams) { | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (team.teamType.permissions === 'POST' && | ||
| team.object.id === object.id && | ||
| operation === 'POST') { | ||
| <span class="cstat-no" title="statement not covered" > return true</span> | ||
| } else if (team.teamType.permissions === 'PATCH' && | ||
| team.object.id === object.id && | ||
| operation === 'PATCH') { | ||
| return true | ||
| } | ||
| } | ||
| | ||
| return false | ||
| } | ||
| | ||
| function unauthenticatedUser (operation, object) { | ||
| // Public/unauthenticated users can GET /collections, filtered by 'published' | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (operation === 'GET' && object && object.path === '/collections') { | ||
| <span class="cstat-no" title="statement not covered" > return {</span> | ||
| filter: <span class="fstat-no" title="function not covered" >(c</span>ollection) => <span class="cstat-no" title="statement not covered" >collection.published</span> | ||
| } | ||
| } | ||
| | ||
| // Public/unauthenticated users can GET /collections/:id/fragments, filtered by 'published' | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (operation === 'GET' && object && object.path === '/collections/:id/fragments') { | ||
| <span class="cstat-no" title="statement not covered" > return {</span> | ||
| filter: <span class="fstat-no" title="function not covered" >(f</span>ragment) => <span class="cstat-no" title="statement not covered" >fragment.published</span> | ||
| } | ||
| } | ||
| | ||
| // and filtered individual collection's properties: id, title, source, content, owners | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (operation === 'GET' && object && object.type === 'collection') { | ||
| <span class="cstat-no" title="statement not covered" > if (object.published) {</span> | ||
| <span class="cstat-no" title="statement not covered" > return {</span> | ||
| filter: <span class="fstat-no" title="function not covered" >(_</span>, key) => <span class="cstat-no" title="statement not covered" >['id', 'title', 'owners'].includes(key)</span> | ||
| } | ||
| } | ||
| } | ||
| | ||
| <span class="missing-if-branch" title="else path not taken" >E</span>if (operation === 'GET' && object && object.type === 'fragment') { | ||
| if (object.published) { | ||
| return { | ||
| filter: <span class="fstat-no" title="function not covered" >(_</span>, key) => <span class="cstat-no" title="statement not covered" >['id', 'title', 'source', 'presentation', 'owners'].includes(key)</span> | ||
| } | ||
| } | ||
| } | ||
| | ||
| return false | ||
| } | ||
| | ||
| var blog = function (user, operation, object, context) { | ||
| // Admins can do anything | ||
| if (user && user.admin === true) return true | ||
| | ||
| if (!user) { | ||
| return unauthenticatedUser(operation, object) | ||
| } | ||
| | ||
| let collection | ||
| | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (object.type === 'collection') { | ||
| <span class="cstat-no" title="statement not covered" > collection = object</span> | ||
| <span class="cstat-no" title="statement not covered" > if (isOwner(user, collection)) {</span> | ||
| <span class="cstat-no" title="statement not covered" > return true</span> | ||
| } | ||
| <span class="cstat-no" title="statement not covered" > if (teamPermissions(user, operation, collection)) {</span> | ||
| <span class="cstat-no" title="statement not covered" > return true</span> | ||
| } | ||
| } else <span class="missing-if-branch" title="else path not taken" >E</span>if (object.type === 'fragment') { | ||
| let fragment = object | ||
| | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (isPublished(fragment) && <span class="branch-1 cbranch-no" title="branch not covered" >operation === 'GET')</span> { | ||
| <span class="cstat-no" title="statement not covered" > return true</span> | ||
| } | ||
| | ||
| if (isOwner(user, fragment)) { | ||
| return true | ||
| } | ||
| | ||
| if (teamPermissions(user, operation, fragment)) { | ||
| return true | ||
| } | ||
| | ||
| <span class="missing-if-branch" title="else path not taken" >E</span>if (Array.isArray(fragment.parents)) { | ||
| collection = fragment.parents[0] | ||
| return teamPermissions(user, operation, collection) | ||
| } | ||
| } else <span class="cstat-no" title="statement not covered" >if (object.type === 'user') {</span> | ||
| <span class="cstat-no" title="statement not covered" > return user.id === object.id</span> | ||
| } | ||
| | ||
| <span class="cstat-no" title="statement not covered" > return false</span> | ||
| } | ||
| | ||
| module.exports = blog | ||
| </pre></td></tr> | ||
| </table></pre> | ||
| <div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:19:07 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../../../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../../../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/modes/journal</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../../../prettify.css" /> | ||
| <link rel="stylesheet" href="../../../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../../../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../../../index.html">All files</a> src/modes/journal | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">90.91% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>30/33</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">92.31% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>48/52</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>2/2</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">93.75% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>30/32</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line high'></div> | ||
| <div class="pad1"> | ||
| <table class="coverage-summary"> | ||
| <thead> | ||
| <tr> | ||
| <th data-col="file" data-fmt="html" data-html="true" class="file">File</th> | ||
| <th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th> | ||
| <th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th> | ||
| <th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th> | ||
| <th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th> | ||
| <th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th> | ||
| <th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| </tr> | ||
| </thead> | ||
| <tbody><tr> | ||
| <td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td> | ||
| <td data-value="90.91" class="pic high"><div class="chart"><div class="cover-fill" style="width: 90%;"></div><div class="cover-empty" style="width:10%;"></div></div></td> | ||
| <td data-value="90.91" class="pct high">90.91%</td> | ||
| <td data-value="33" class="abs high">30/33</td> | ||
| <td data-value="92.31" class="pct high">92.31%</td> | ||
| <td data-value="52" class="abs high">48/52</td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="2" class="abs high">2/2</td> | ||
| <td data-value="93.75" class="pct high">93.75%</td> | ||
| <td data-value="32" class="abs high">30/32</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </div><div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:19:07 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../../../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../../../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/modes/journal/index.js</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../../../prettify.css" /> | ||
| <link rel="stylesheet" href="../../../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../../../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../../../index.html">All files</a> / <a href="index.html">src/modes/journal</a> index.js | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">90.91% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>30/33</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">92.31% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>48/52</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>2/2</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">93.75% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>30/32</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line high'></div> | ||
| <pre><table class="coverage"> | ||
| <tr><td class="line-count quiet">1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 | ||
| 22 | ||
| 23 | ||
| 24 | ||
| 25 | ||
| 26 | ||
| 27 | ||
| 28 | ||
| 29 | ||
| 30 | ||
| 31 | ||
| 32 | ||
| 33 | ||
| 34 | ||
| 35 | ||
| 36 | ||
| 37 | ||
| 38 | ||
| 39 | ||
| 40 | ||
| 41 | ||
| 42 | ||
| 43 | ||
| 44 | ||
| 45 | ||
| 46 | ||
| 47 | ||
| 48 | ||
| 49 | ||
| 50 | ||
| 51 | ||
| 52 | ||
| 53 | ||
| 54 | ||
| 55 | ||
| 56 | ||
| 57 | ||
| 58 | ||
| 59 | ||
| 60 | ||
| 61 | ||
| 62 | ||
| 63 | ||
| 64 | ||
| 65 | ||
| 66 | ||
| 67 | ||
| 68 | ||
| 69 | ||
| 70 | ||
| 71 | ||
| 72 | ||
| 73 | ||
| 74 | ||
| 75 | ||
| 76 | ||
| 77 | ||
| 78 | ||
| 79 | ||
| 80 | ||
| 81 | ||
| 82 | ||
| 83 | ||
| 84</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">14x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">11x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">11x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">9x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">14x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-yes">13x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">12x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">12x</span> | ||
| <span class="cline-any cline-yes">18x</span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">9x</span> | ||
| <span class="cline-any cline-yes">7x</span> | ||
| <span class="cline-any cline-yes">7x</span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">9x</span> | ||
| <span class="cline-any cline-yes">14x</span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">11x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">6x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">function isAllowed (operation, permission) { | ||
| if ((operation === 'read' || operation === 'update' || operation === 'delete') && | ||
| permission === 'delete') { | ||
| return true | ||
| } | ||
| | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if ((operation === 'read' || operation === 'update') && | ||
| permission === 'update') { | ||
| <span class="cstat-no" title="statement not covered" > return true</span> | ||
| } | ||
| | ||
| if ((operation === 'read') && | ||
| permission === 'read') { | ||
| return true | ||
| } | ||
| | ||
| if ((operation === 'create') && | ||
| permission === 'create') { | ||
| return true | ||
| } | ||
| } | ||
| | ||
| function can (user, operation, object) { | ||
| // Publicly-readable | ||
| if (object.type === 'fragment' && | ||
| object.state === 'published' && | ||
| operation === 'read') { | ||
| return true | ||
| } else if (user === undefined) { | ||
| return false | ||
| } | ||
| | ||
| // Admins and Owners (also owners of parent objects) | ||
| | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (user.admin === true) <span class="cstat-no" title="statement not covered" >return true</span> | ||
| | ||
| for (const objectOwnerId of object.owners) { | ||
| if (objectOwnerId === user.id) { | ||
| return true | ||
| } | ||
| } | ||
| | ||
| if (Array.isArray(object.parents)) { | ||
| for (const parent of object.parents) { | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (parent.owners.includes(user)) { | ||
| <span class="cstat-no" title="statement not covered" > return true</span> | ||
| } | ||
| } | ||
| } | ||
| | ||
| // Teams | ||
| | ||
| for (const team of user.teams) { | ||
| if (team.teamType.active) { | ||
| if (isAllowed(operation, team.teamType.permissions) && | ||
| team.object === object && | ||
| team.teamType.active(object)) { | ||
| return true | ||
| } | ||
| } else { | ||
| if (isAllowed(operation, team.teamType.permissions) && | ||
| team.object === object) { | ||
| return true | ||
| } | ||
| } | ||
| } | ||
| | ||
| // Users with permissions for parents of object | ||
| // This is only applicable in certain states | ||
| | ||
| if ((object.state === 'submitted' || object.state === undefined) && | ||
| Array.isArray(object.parents)) { | ||
| for (const parent of object.parents) { | ||
| <span class="missing-if-branch" title="else path not taken" >E</span>if (can(user, operation, parent)) { | ||
| return true | ||
| } | ||
| } | ||
| } | ||
| | ||
| return false | ||
| } | ||
| | ||
| module.exports = can | ||
| </pre></td></tr> | ||
| </table></pre> | ||
| <div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:19:07 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../../../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../../../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/modes/journal/journal_test.js</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../../../prettify.css" /> | ||
| <link rel="stylesheet" href="../../../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../../../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../../../index.html">All files</a> / <a href="index.html">src/modes/journal</a> journal_test.js | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>0/74</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>0/2</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>0/23</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>0/74</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line low'></div> | ||
| <pre><table class="coverage"> | ||
| <tr><td class="line-count quiet">1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 | ||
| 22 | ||
| 23 | ||
| 24 | ||
| 25 | ||
| 26 | ||
| 27 | ||
| 28 | ||
| 29 | ||
| 30 | ||
| 31 | ||
| 32 | ||
| 33 | ||
| 34 | ||
| 35 | ||
| 36 | ||
| 37 | ||
| 38 | ||
| 39 | ||
| 40 | ||
| 41 | ||
| 42 | ||
| 43 | ||
| 44 | ||
| 45 | ||
| 46 | ||
| 47 | ||
| 48 | ||
| 49 | ||
| 50 | ||
| 51 | ||
| 52 | ||
| 53 | ||
| 54 | ||
| 55 | ||
| 56 | ||
| 57 | ||
| 58 | ||
| 59 | ||
| 60 | ||
| 61 | ||
| 62 | ||
| 63 | ||
| 64 | ||
| 65 | ||
| 66 | ||
| 67 | ||
| 68 | ||
| 69 | ||
| 70 | ||
| 71 | ||
| 72 | ||
| 73 | ||
| 74 | ||
| 75 | ||
| 76 | ||
| 77 | ||
| 78 | ||
| 79 | ||
| 80 | ||
| 81 | ||
| 82 | ||
| 83 | ||
| 84 | ||
| 85 | ||
| 86 | ||
| 87 | ||
| 88 | ||
| 89 | ||
| 90 | ||
| 91 | ||
| 92 | ||
| 93 | ||
| 94 | ||
| 95 | ||
| 96 | ||
| 97 | ||
| 98 | ||
| 99 | ||
| 100 | ||
| 101 | ||
| 102 | ||
| 103 | ||
| 104 | ||
| 105 | ||
| 106 | ||
| 107 | ||
| 108 | ||
| 109 | ||
| 110 | ||
| 111 | ||
| 112 | ||
| 113 | ||
| 114 | ||
| 115 | ||
| 116 | ||
| 117 | ||
| 118 | ||
| 119 | ||
| 120 | ||
| 121 | ||
| 122 | ||
| 123 | ||
| 124 | ||
| 125 | ||
| 126 | ||
| 127 | ||
| 128 | ||
| 129 | ||
| 130 | ||
| 131 | ||
| 132 | ||
| 133 | ||
| 134 | ||
| 135 | ||
| 136 | ||
| 137 | ||
| 138 | ||
| 139 | ||
| 140 | ||
| 141 | ||
| 142 | ||
| 143 | ||
| 144 | ||
| 145 | ||
| 146 | ||
| 147 | ||
| 148 | ||
| 149 | ||
| 150 | ||
| 151 | ||
| 152 | ||
| 153 | ||
| 154 | ||
| 155 | ||
| 156 | ||
| 157 | ||
| 158 | ||
| 159 | ||
| 160 | ||
| 161 | ||
| 162 | ||
| 163 | ||
| 164 | ||
| 165 | ||
| 166 | ||
| 167 | ||
| 168 | ||
| 169 | ||
| 170 | ||
| 171 | ||
| 172 | ||
| 173 | ||
| 174 | ||
| 175 | ||
| 176 | ||
| 177 | ||
| 178 | ||
| 179 | ||
| 180 | ||
| 181 | ||
| 182 | ||
| 183 | ||
| 184 | ||
| 185 | ||
| 186 | ||
| 187 | ||
| 188 | ||
| 189 | ||
| 190 | ||
| 191 | ||
| 192 | ||
| 193 | ||
| 194 | ||
| 195 | ||
| 196 | ||
| 197 | ||
| 198 | ||
| 199 | ||
| 200 | ||
| 201 | ||
| 202 | ||
| 203 | ||
| 204 | ||
| 205 | ||
| 206 | ||
| 207 | ||
| 208 | ||
| 209 | ||
| 210 | ||
| 211 | ||
| 212 | ||
| 213 | ||
| 214 | ||
| 215 | ||
| 216 | ||
| 217 | ||
| 218 | ||
| 219 | ||
| 220 | ||
| 221 | ||
| 222 | ||
| 223 | ||
| 224 | ||
| 225 | ||
| 226 | ||
| 227 | ||
| 228 | ||
| 229 | ||
| 230 | ||
| 231 | ||
| 232 | ||
| 233 | ||
| 234 | ||
| 235</td><td class="line-coverage quiet"><span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">const expect = <span class="cstat-no" title="statement not covered" >require('expect.js')</span> | ||
| const Authsome = <span class="cstat-no" title="statement not covered" >require('../../../src')</span> | ||
| const journal = <span class="cstat-no" title="statement not covered" >require('../journal')</span> | ||
| | ||
| // Below we setup a convincing journal user/fragment/collection/team situation | ||
| | ||
| let admin = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_1', | ||
| name: 'Admin user', | ||
| admin: true, | ||
| type: 'user' | ||
| } | ||
| | ||
| let admin2 = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_2', | ||
| name: 'Admin user 2', | ||
| admin: true, | ||
| type: 'user' | ||
| } | ||
| | ||
| let collection = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'collection_1', | ||
| name: 'Journal of Authsomeness', | ||
| owners: [admin.id, admin2.id], | ||
| type: 'collection' | ||
| } | ||
| | ||
| let teams = <span class="cstat-no" title="statement not covered" >{</span> | ||
| teamUsers: { | ||
| name: 'Users', | ||
| permissions: 'create' | ||
| }, | ||
| teamReviewers: { | ||
| name: 'Reviewers', | ||
| permissions: 'read', | ||
| active: <span class="fstat-no" title="function not covered" >fu</span>nction (object) { | ||
| <span class="cstat-no" title="statement not covered" > if (object.state === 'reviewing') {</span> | ||
| <span class="cstat-no" title="statement not covered" > return true</span> | ||
| } | ||
| } | ||
| }, | ||
| teamCoauthors: { | ||
| name: 'Coauthors', | ||
| permissions: 'update' | ||
| }, | ||
| teamEditors: { | ||
| name: 'Editors', | ||
| permissions: 'delete' | ||
| } | ||
| } | ||
| | ||
| let teamUsers = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'team_1', | ||
| object: collection, | ||
| type: 'team', | ||
| teamType: teams.teamUsers | ||
| } | ||
| | ||
| let teamEditors = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'team_3', | ||
| object: collection, | ||
| type: 'team', | ||
| teamType: teams.teamEditors | ||
| } | ||
| | ||
| let user3 = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_3', | ||
| name: 'User Three', | ||
| teams: [teamUsers], | ||
| type: 'user' | ||
| } | ||
| | ||
| let user4 = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_4', | ||
| name: 'User Four', | ||
| teams: [teamUsers] | ||
| } | ||
| | ||
| let editor1 = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_5', | ||
| name: 'Editor of Journal of Authsomeness', | ||
| teams: [teamUsers, teamEditors] | ||
| } | ||
| | ||
| let collectionAdmin1 = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_6', | ||
| name: 'Collection Admin of Journal of Authsomeness', | ||
| teams: [teamUsers] | ||
| } | ||
| | ||
| const authsome = <span class="cstat-no" title="statement not covered" >new Authsome({mode: journal, teams: teams})</span> | ||
| | ||
| <span class="cstat-no" title="statement not covered" >describe('Journal mode', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| let manuscript = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'fragment_1', | ||
| title: 'Manuscript', | ||
| owners: [user3.id], | ||
| parents: [collection], | ||
| state: 'writing', | ||
| type: 'fragment' | ||
| } | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('collection admins', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| let submittedPaper = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'fragment_2', | ||
| title: 'Submitted paper', | ||
| owners: [user4.id], | ||
| parents: [collection], | ||
| type: 'fragment', | ||
| state: 'submitted' | ||
| } | ||
| | ||
| <span class="cstat-no" title="statement not covered" > beforeAll(<span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > collection.owners.push(collectionAdmin1.id)</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to do anything if they are owners/collection admins of a parent collection', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(collectionAdmin1, 'delete', submittedPaper)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(true)</span> | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('editors', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| let submittedPaper = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'fragment_2', | ||
| title: 'Submitted paper', | ||
| owners: [user4.id], | ||
| parents: [collection], | ||
| type: 'fragment', | ||
| state: 'submitted' | ||
| } | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to read a submitted paper if they are editors of a parent collection', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(editor1, 'read', submittedPaper)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(true)</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should not be able to read paper that has not yet been submitted, even if they are editors of a parent collection', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(editor1, 'read', manuscript)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(false)</span> | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('users', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to create a new paper/fragment', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(user3, 'create', manuscript)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(true)</span> | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('coauthors', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > beforeAll(<span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| let teamCoauthors = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'team_3', | ||
| object: manuscript, | ||
| type: 'team', | ||
| teamType: teams.teamCoauthors | ||
| } | ||
| | ||
| <span class="cstat-no" title="statement not covered" > user3.teams = [teamCoauthors, teamUsers]</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to update the paper/fragment', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(user3, 'update', manuscript)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(true)</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > afterAll(<span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > user3.teams = [teamUsers]</span> | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('reviewers', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > describe('reviewing a manuscript', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > beforeAll(<span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| let teamReviewers = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'team_2', | ||
| object: manuscript, | ||
| type: 'team', | ||
| teamType: teams.teamReviewers | ||
| } | ||
| | ||
| // Add user to teamReviewers (reviewers of fragment) | ||
| us<span class="cstat-no" title="statement not covered" >er4.teams = [teamReviewers, teamUsers]</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should only be able to read fragments when those fragments are in review and they are team members', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(user4, 'read', manuscript)</span> | ||
| | ||
| // Shouldn't be able to read it if it's not in state 'reviewing' | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(false)</span> | ||
| | ||
| // Should be able to read it if it's in a state 'reviewing' | ||
| <span class="cstat-no" title="statement not covered" > manuscript.state = 'reviewing'</span> | ||
| <span class="cstat-no" title="statement not covered" > permission = await authsome.can(user4, 'read', manuscript)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(true)</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should not be able to delete fragments which they are reviewing', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(user4, 'delete', manuscript)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(false)</span> | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > afterAll(<span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > user4.teams = [teamUsers]</span> | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to create fragments', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| let review = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'fragment_2', | ||
| title: 'Review of Manuscript', | ||
| owners: [user3.id], | ||
| parents: [collection], | ||
| type: 'fragment' | ||
| } | ||
| | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(user4, 'create', review)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(true)</span> | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('public', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('should only be able to read published fragments/papers', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| <span class="cstat-no" title="statement not covered" > manuscript.state = 'editing'</span> | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(undefined, 'read', manuscript)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(false)</span> | ||
| | ||
| <span class="cstat-no" title="statement not covered" > manuscript.state = 'published'</span> | ||
| <span class="cstat-no" title="statement not covered" > permission = await authsome.can(undefined, 'read', manuscript)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(true)</span> | ||
| }) | ||
| }) | ||
| }) | ||
| </pre></td></tr> | ||
| </table></pre> | ||
| <div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:02:08 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../../../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../../../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/modes/noon</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../../../prettify.css" /> | ||
| <link rel="stylesheet" href="../../../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../../../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../../../index.html">All files</a> src/modes/noon | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">56% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>14/25</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">34.29% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>12/35</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>1/1</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">58.33% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>14/24</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line medium'></div> | ||
| <div class="pad1"> | ||
| <table class="coverage-summary"> | ||
| <thead> | ||
| <tr> | ||
| <th data-col="file" data-fmt="html" data-html="true" class="file">File</th> | ||
| <th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th> | ||
| <th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th> | ||
| <th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th> | ||
| <th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th> | ||
| <th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th> | ||
| <th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| </tr> | ||
| </thead> | ||
| <tbody><tr> | ||
| <td class="file medium" data-value="index.js"><a href="index.js.html">index.js</a></td> | ||
| <td data-value="56" class="pic medium"><div class="chart"><div class="cover-fill" style="width: 56%;"></div><div class="cover-empty" style="width:44%;"></div></div></td> | ||
| <td data-value="56" class="pct medium">56%</td> | ||
| <td data-value="25" class="abs medium">14/25</td> | ||
| <td data-value="34.29" class="pct low">34.29%</td> | ||
| <td data-value="35" class="abs low">12/35</td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="1" class="abs high">1/1</td> | ||
| <td data-value="58.33" class="pct medium">58.33%</td> | ||
| <td data-value="24" class="abs medium">14/24</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </div><div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:19:07 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../../../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../../../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/modes/noon/index.js</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../../../prettify.css" /> | ||
| <link rel="stylesheet" href="../../../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../../../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../../../index.html">All files</a> / <a href="index.html">src/modes/noon</a> index.js | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">56% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>14/25</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">34.29% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>12/35</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>1/1</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">58.33% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>14/24</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line medium'></div> | ||
| <pre><table class="coverage"> | ||
| <tr><td class="line-count quiet">1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 | ||
| 22 | ||
| 23 | ||
| 24 | ||
| 25 | ||
| 26 | ||
| 27 | ||
| 28 | ||
| 29 | ||
| 30 | ||
| 31 | ||
| 32 | ||
| 33 | ||
| 34 | ||
| 35 | ||
| 36 | ||
| 37 | ||
| 38 | ||
| 39 | ||
| 40 | ||
| 41 | ||
| 42 | ||
| 43 | ||
| 44 | ||
| 45 | ||
| 46 | ||
| 47 | ||
| 48 | ||
| 49 | ||
| 50 | ||
| 51 | ||
| 52 | ||
| 53 | ||
| 54</td><td class="line-coverage quiet"><span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">var noon = function (user, operation, object) { | ||
| let fragment = object | ||
| let collection = fragment.parents[0] | ||
| | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (user.admin === true) <span class="cstat-no" title="statement not covered" >return true</span> | ||
| | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (operation === 'update' || operation === 'delete') { | ||
| <span class="cstat-no" title="statement not covered" > for (const fragmentOwnerId of fragment.owners) {</span> | ||
| <span class="cstat-no" title="statement not covered" > if (fragmentOwnerId === user.id) {</span> | ||
| <span class="cstat-no" title="statement not covered" > return true</span> | ||
| } | ||
| } | ||
| } | ||
| | ||
| <span class="missing-if-branch" title="else path not taken" >E</span>if (operation === 'create') { | ||
| for (const collectionOwnerId of collection.owners) { | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (collectionOwnerId === user.id) { | ||
| <span class="cstat-no" title="statement not covered" > return true</span> | ||
| } | ||
| } | ||
| } | ||
| | ||
| for (const team of user.teams) { | ||
| if (team.teamType.active()) { | ||
| <span class="missing-if-branch" title="else path not taken" >E</span>if (team.teamType.permissions === 'all' && | ||
| team.object === collection && | ||
| operation === 'create') { | ||
| return true | ||
| } | ||
| | ||
| <span class="cstat-no" title="statement not covered" > if (team.teamType.permissions === 'all' &&</span> | ||
| team.object === fragment && | ||
| (operation === 'update' || operation === 'delete')) { | ||
| <span class="cstat-no" title="statement not covered" > return true</span> | ||
| } | ||
| | ||
| <span class="cstat-no" title="statement not covered" > if (team.teamType.permissions === 'create' &&</span> | ||
| team.object === collection && | ||
| operation === 'create') { | ||
| <span class="cstat-no" title="statement not covered" > return true</span> | ||
| } | ||
| | ||
| <span class="cstat-no" title="statement not covered" > if (team.teamType.permissions === 'update' &&</span> | ||
| team.object === fragment && | ||
| operation === 'update') { | ||
| <span class="cstat-no" title="statement not covered" > return true</span> | ||
| } | ||
| } | ||
| } | ||
| return false | ||
| } | ||
| | ||
| module.exports = noon | ||
| </pre></td></tr> | ||
| </table></pre> | ||
| <div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:19:07 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../../../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../../../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/modes/noon/noon_test.js</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../../../prettify.css" /> | ||
| <link rel="stylesheet" href="../../../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../../../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../../../index.html">All files</a> / <a href="index.html">src/modes/noon</a> noon_test.js | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>0/25</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>0/0</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>0/7</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>0/25</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line low'></div> | ||
| <pre><table class="coverage"> | ||
| <tr><td class="line-count quiet">1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 | ||
| 22 | ||
| 23 | ||
| 24 | ||
| 25 | ||
| 26 | ||
| 27 | ||
| 28 | ||
| 29 | ||
| 30 | ||
| 31 | ||
| 32 | ||
| 33 | ||
| 34 | ||
| 35 | ||
| 36 | ||
| 37 | ||
| 38 | ||
| 39 | ||
| 40 | ||
| 41 | ||
| 42 | ||
| 43 | ||
| 44 | ||
| 45 | ||
| 46 | ||
| 47 | ||
| 48 | ||
| 49 | ||
| 50 | ||
| 51 | ||
| 52 | ||
| 53 | ||
| 54 | ||
| 55 | ||
| 56 | ||
| 57 | ||
| 58 | ||
| 59 | ||
| 60 | ||
| 61 | ||
| 62 | ||
| 63 | ||
| 64 | ||
| 65 | ||
| 66 | ||
| 67 | ||
| 68 | ||
| 69 | ||
| 70 | ||
| 71 | ||
| 72 | ||
| 73 | ||
| 74 | ||
| 75 | ||
| 76 | ||
| 77 | ||
| 78 | ||
| 79 | ||
| 80 | ||
| 81 | ||
| 82 | ||
| 83 | ||
| 84 | ||
| 85 | ||
| 86 | ||
| 87 | ||
| 88 | ||
| 89 | ||
| 90 | ||
| 91 | ||
| 92 | ||
| 93</td><td class="line-coverage quiet"><span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">const expect = <span class="cstat-no" title="statement not covered" >require('expect.js')</span> | ||
| const Authsome = <span class="cstat-no" title="statement not covered" >require('../../../src')</span> | ||
| const noon = <span class="cstat-no" title="statement not covered" >require('../noon')</span> | ||
| | ||
| let admin = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_1', | ||
| name: 'Admin user', | ||
| admin: true, | ||
| type: 'user' | ||
| } | ||
| | ||
| let collection = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'collection_1', | ||
| name: 'Journal of Afternooning', | ||
| owners: [admin.id], | ||
| type: 'collection' | ||
| } | ||
| | ||
| let teams = <span class="cstat-no" title="statement not covered" >{</span> | ||
| teamBeforenooners: { | ||
| name: 'Beforenooners', | ||
| permissions: 'all', | ||
| active: <span class="fstat-no" title="function not covered" >fu</span>nction (p) { | ||
| <span class="cstat-no" title="statement not covered" > return (new Date()).getHours() <= 12</span> | ||
| } | ||
| }, | ||
| teamAfternooners: { | ||
| name: 'Afternooners', | ||
| permissions: 'all', | ||
| active: <span class="fstat-no" title="function not covered" >fu</span>nction (time) { | ||
| <span class="cstat-no" title="statement not covered" > return (new Date()).getHours() > 12</span> | ||
| } | ||
| } | ||
| } | ||
| | ||
| let teamBeforenooners = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'team_1', | ||
| object: collection, | ||
| type: 'team', | ||
| teamType: teams.teamBeforenooners | ||
| } | ||
| | ||
| let user2 = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_2', | ||
| name: 'User One', | ||
| teams: [teamBeforenooners], | ||
| type: 'user' | ||
| } | ||
| | ||
| let fragment = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'fragment_1', | ||
| title: 'Post', | ||
| owners: [user2.id], | ||
| parents: [collection], | ||
| type: 'fragment' | ||
| } | ||
| | ||
| let teamAfternooners = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'team_2', | ||
| object: collection, | ||
| type: 'team', | ||
| teamType: teams.teamAfternooners | ||
| } | ||
| | ||
| let user3 = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_3', | ||
| name: 'User Two', | ||
| teams: [teamAfternooners], | ||
| type: 'user' | ||
| } | ||
| | ||
| const authsome = <span class="cstat-no" title="statement not covered" >new Authsome({mode: noon, teams: teams})</span> | ||
| | ||
| <span class="cstat-no" title="statement not covered" >describe('Noon mode', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > describe('Beforenooners', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to create a fragment only if it\'s before noon, and not if it\'s after noon', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| let beforeNoon = <span class="cstat-no" title="statement not covered" >(new Date()).getHours() <= 1</span>2 | ||
| | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(user2, 'create', fragment)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(beforeNoon)</span> | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('Afternooners', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to create a fragment only if it\'s after noon, and not if it\'s before noon', <span class="fstat-no" title="function not covered" >as</span>ync () => {</span> | ||
| let afterNoon = <span class="cstat-no" title="statement not covered" >(new Date()).getHours() > 1</span>2 | ||
| | ||
| var permission = <span class="cstat-no" title="statement not covered" >await authsome.can(user3, 'create', fragment)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(afterNoon)</span> | ||
| }) | ||
| }) | ||
| }) | ||
| </pre></td></tr> | ||
| </table></pre> | ||
| <div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:02:08 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../../../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../../../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/modes/test</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../../../prettify.css" /> | ||
| <link rel="stylesheet" href="../../../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../../../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../../../index.html">All files</a> src/modes/test | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">95.45% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>21/22</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">90.32% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>28/31</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>4/4</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">95.45% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>21/22</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line high'></div> | ||
| <div class="pad1"> | ||
| <table class="coverage-summary"> | ||
| <thead> | ||
| <tr> | ||
| <th data-col="file" data-fmt="html" data-html="true" class="file">File</th> | ||
| <th data-col="pic" data-type="number" data-fmt="html" data-html="true" class="pic"></th> | ||
| <th data-col="statements" data-type="number" data-fmt="pct" class="pct">Statements</th> | ||
| <th data-col="statements_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="branches" data-type="number" data-fmt="pct" class="pct">Branches</th> | ||
| <th data-col="branches_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="functions" data-type="number" data-fmt="pct" class="pct">Functions</th> | ||
| <th data-col="functions_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| <th data-col="lines" data-type="number" data-fmt="pct" class="pct">Lines</th> | ||
| <th data-col="lines_raw" data-type="number" data-fmt="html" class="abs"></th> | ||
| </tr> | ||
| </thead> | ||
| <tbody><tr> | ||
| <td class="file high" data-value="index.js"><a href="index.js.html">index.js</a></td> | ||
| <td data-value="95.45" class="pic high"><div class="chart"><div class="cover-fill" style="width: 95%;"></div><div class="cover-empty" style="width:5%;"></div></div></td> | ||
| <td data-value="95.45" class="pct high">95.45%</td> | ||
| <td data-value="22" class="abs high">21/22</td> | ||
| <td data-value="90.32" class="pct high">90.32%</td> | ||
| <td data-value="31" class="abs high">28/31</td> | ||
| <td data-value="100" class="pct high">100%</td> | ||
| <td data-value="4" class="abs high">4/4</td> | ||
| <td data-value="95.45" class="pct high">95.45%</td> | ||
| <td data-value="22" class="abs high">21/22</td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </div><div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:19:07 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../../../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../../../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/modes/test/index.js</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../../../prettify.css" /> | ||
| <link rel="stylesheet" href="../../../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../../../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../../../index.html">All files</a> / <a href="index.html">src/modes/test</a> index.js | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">95.45% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>21/22</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">90.32% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>28/31</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>4/4</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">95.45% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>21/22</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line high'></div> | ||
| <pre><table class="coverage"> | ||
| <tr><td class="line-count quiet">1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 | ||
| 22 | ||
| 23 | ||
| 24 | ||
| 25 | ||
| 26 | ||
| 27 | ||
| 28 | ||
| 29 | ||
| 30 | ||
| 31 | ||
| 32 | ||
| 33 | ||
| 34 | ||
| 35 | ||
| 36 | ||
| 37 | ||
| 38 | ||
| 39 | ||
| 40 | ||
| 41 | ||
| 42 | ||
| 43 | ||
| 44 | ||
| 45 | ||
| 46 | ||
| 47 | ||
| 48 | ||
| 49 | ||
| 50 | ||
| 51 | ||
| 52</td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-yes">7x</span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">5x</span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">4x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">3x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">2x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-yes">1x</span> | ||
| <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">// WARNING: Used purely for testing reasons | ||
| // - Everything is allowed for owners of objects or the objects' parents | ||
| // - Nothing is allowed for unauthenticated users | ||
| // - Public things can be read | ||
| // - User with id user_3 gets filteret results | ||
| var test = function (user, operation, object, context) { | ||
| if (!user) { | ||
| if (operation === 'GET' && object.public) { | ||
| return true | ||
| } | ||
| return false | ||
| } | ||
| | ||
| // Example of a filtered authorization response | ||
| // In this case: | ||
| // 1. a filter that returns user_3's collections | ||
| // 2. a filter that returns the 'id' property | ||
| if (user && user.id === 'user_3') { | ||
| if (object === 'collections') { | ||
| return { | ||
| permission: 'filter', | ||
| filter: (object) => object.owners.includes('user_3') | ||
| } | ||
| } else <span class="missing-if-branch" title="else path not taken" >E</span>if (object && object.type === 'collection') { | ||
| return { | ||
| permission: 'filter', | ||
| filter: (value, key) => key === 'id' | ||
| } | ||
| } | ||
| } | ||
| | ||
| if (user && operation && object.owners.includes(user.id)) { | ||
| return true | ||
| } | ||
| | ||
| if (user && operation && object && context) { | ||
| <span class="missing-if-branch" title="if path not taken" >I</span>if (object.public) { | ||
| <span class="cstat-no" title="statement not covered" > return true</span> | ||
| } | ||
| | ||
| return context.models.collection.find(object.parents[0]).then(collection => { | ||
| <span class="missing-if-branch" title="else path not taken" >E</span>if (collection.owners.includes(user.id)) { | ||
| return true | ||
| } | ||
| }) | ||
| } | ||
| | ||
| return false | ||
| } | ||
| | ||
| module.exports = test | ||
| </pre></td></tr> | ||
| </table></pre> | ||
| <div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:19:07 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../../../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../../../sorter.js"></script> | ||
| </body> | ||
| </html> |
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <title>Code coverage report for src/modes/test/test_test.js</title> | ||
| <meta charset="utf-8" /> | ||
| <link rel="stylesheet" href="../../../prettify.css" /> | ||
| <link rel="stylesheet" href="../../../base.css" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <style type='text/css'> | ||
| .coverage-summary .sorter { | ||
| background-image: url(../../../sort-arrow-sprite.png); | ||
| } | ||
| </style> | ||
| </head> | ||
| <body> | ||
| <div class='wrapper'> | ||
| <div class='pad1'> | ||
| <h1> | ||
| <a href="../../../index.html">All files</a> / <a href="index.html">src/modes/test</a> test_test.js | ||
| </h1> | ||
| <div class='clearfix'> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Statements</span> | ||
| <span class='fraction'>0/46</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">100% </span> | ||
| <span class="quiet">Branches</span> | ||
| <span class='fraction'>0/0</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Functions</span> | ||
| <span class='fraction'>0/20</span> | ||
| </div> | ||
| <div class='fl pad1y space-right2'> | ||
| <span class="strong">0% </span> | ||
| <span class="quiet">Lines</span> | ||
| <span class='fraction'>0/46</span> | ||
| </div> | ||
| </div> | ||
| </div> | ||
| <div class='status-line low'></div> | ||
| <pre><table class="coverage"> | ||
| <tr><td class="line-count quiet">1 | ||
| 2 | ||
| 3 | ||
| 4 | ||
| 5 | ||
| 6 | ||
| 7 | ||
| 8 | ||
| 9 | ||
| 10 | ||
| 11 | ||
| 12 | ||
| 13 | ||
| 14 | ||
| 15 | ||
| 16 | ||
| 17 | ||
| 18 | ||
| 19 | ||
| 20 | ||
| 21 | ||
| 22 | ||
| 23 | ||
| 24 | ||
| 25 | ||
| 26 | ||
| 27 | ||
| 28 | ||
| 29 | ||
| 30 | ||
| 31 | ||
| 32 | ||
| 33 | ||
| 34 | ||
| 35 | ||
| 36 | ||
| 37 | ||
| 38 | ||
| 39 | ||
| 40 | ||
| 41 | ||
| 42 | ||
| 43 | ||
| 44 | ||
| 45 | ||
| 46 | ||
| 47 | ||
| 48 | ||
| 49 | ||
| 50 | ||
| 51 | ||
| 52 | ||
| 53 | ||
| 54 | ||
| 55 | ||
| 56 | ||
| 57 | ||
| 58 | ||
| 59 | ||
| 60 | ||
| 61 | ||
| 62 | ||
| 63 | ||
| 64 | ||
| 65 | ||
| 66 | ||
| 67 | ||
| 68 | ||
| 69 | ||
| 70 | ||
| 71 | ||
| 72 | ||
| 73 | ||
| 74 | ||
| 75 | ||
| 76 | ||
| 77 | ||
| 78 | ||
| 79 | ||
| 80 | ||
| 81 | ||
| 82 | ||
| 83 | ||
| 84 | ||
| 85 | ||
| 86 | ||
| 87 | ||
| 88 | ||
| 89 | ||
| 90 | ||
| 91 | ||
| 92 | ||
| 93 | ||
| 94 | ||
| 95 | ||
| 96 | ||
| 97 | ||
| 98 | ||
| 99 | ||
| 100 | ||
| 101 | ||
| 102 | ||
| 103 | ||
| 104 | ||
| 105 | ||
| 106 | ||
| 107 | ||
| 108 | ||
| 109 | ||
| 110 | ||
| 111</td><td class="line-coverage quiet"><span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-no"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span> | ||
| <span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">const expect = <span class="cstat-no" title="statement not covered" >require('expect.js')</span> | ||
| const Authsome = <span class="cstat-no" title="statement not covered" >require('../../../src')</span> | ||
| const test = <span class="cstat-no" title="statement not covered" >require('../test')</span> | ||
| | ||
| const pickBy = <span class="cstat-no" title="statement not covered" >require('lodash/pickby')</span> | ||
| | ||
| let user1 = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user1', | ||
| name: 'Just A User', | ||
| type: 'user' | ||
| } | ||
| | ||
| let user2 = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_2', | ||
| name: 'User Two', | ||
| type: 'user' | ||
| } | ||
| | ||
| let filterUser = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'user_3', | ||
| name: 'User Three', | ||
| type: 'user' | ||
| } | ||
| | ||
| let collection = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'collection_1', | ||
| name: 'Blog', | ||
| owners: [user1.id], | ||
| type: 'collection' | ||
| } | ||
| | ||
| let fragment = <span class="cstat-no" title="statement not covered" >{</span> | ||
| id: 'fragment_1', | ||
| title: 'Post', | ||
| owners: [user2.id], | ||
| parents: [collection], | ||
| type: 'fragment' | ||
| } | ||
| | ||
| let authsome = <span class="cstat-no" title="statement not covered" >new Authsome({mode: test})</span> | ||
| | ||
| <span class="cstat-no" title="statement not covered" >describe('test mode', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > describe('a user we filter', <span class="fstat-no" title="function not covered" >()</span> => {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('should return an object filter when asking about reading all collections', <span class="fstat-no" title="function not covered" >()</span> => {</span> | ||
| <span class="cstat-no" title="statement not covered" > return authsome.can(filterUser, 'GET', 'collections').then(<span class="fstat-no" title="function not covered" >re</span>sult => {</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(result.permission).to.eql('filter')</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(result.filter).to.be.a('function')</span> | ||
| | ||
| let filtered = <span class="cstat-no" title="statement not covered" >[collection].filter(result.filter)</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(filtered).to.eql([])</span> | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should return a property filter when asking about reading a collection', <span class="fstat-no" title="function not covered" >()</span> => {</span> | ||
| <span class="cstat-no" title="statement not covered" > return authsome.can(filterUser, 'GET', collection).then(<span class="fstat-no" title="function not covered" >re</span>sult => {</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(result.permission).to.eql('filter')</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(result.filter).to.be.a('function')</span> | ||
| | ||
| let filtered = <span class="cstat-no" title="statement not covered" >pickBy(collection, result.filter)</span> | ||
| | ||
| <span class="cstat-no" title="statement not covered" > expect(filtered).to.eql({id: 'collection_1'})</span> | ||
| }) | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('just a random user', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('should not be able to delete fragments owned by someone else', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > return authsome.can(user1, 'DELETE', fragment).then(<span class="fstat-no" title="function not covered" >pe</span>rmission => {</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(false)</span> | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to create fragments', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > return authsome.can(user2, 'POST', fragment).then(<span class="fstat-no" title="function not covered" >pe</span>rmission => {</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(true)</span> | ||
| }) | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('unauthenticated user', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('should not be able to create a fragment', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > return authsome.can(undefined, 'POST', fragment).then(<span class="fstat-no" title="function not covered" >pe</span>rmission => {</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(false)</span> | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to read a public fragment', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| let publicFragment = <span class="cstat-no" title="statement not covered" >Object.assign({public: true}, fragment)</span> | ||
| <span class="cstat-no" title="statement not covered" > return authsome.can(undefined, 'GET', publicFragment).then(<span class="fstat-no" title="function not covered" >pe</span>rmission => {</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(true)</span> | ||
| }) | ||
| }) | ||
| }) | ||
| | ||
| <span class="cstat-no" title="statement not covered" > describe('contextualized request', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| <span class="cstat-no" title="statement not covered" > it('should be able to delete a fragment if owner of parent collection', <span class="fstat-no" title="function not covered" >fu</span>nction () {</span> | ||
| const context = <span class="cstat-no" title="statement not covered" >{</span> | ||
| models: { | ||
| collection: { | ||
| find: <span class="fstat-no" title="function not covered" >(i</span>d) =<span class="cstat-no" title="statement not covered" >> Promise.resolve(collection</span>) | ||
| } | ||
| } | ||
| } | ||
| <span class="cstat-no" title="statement not covered" > authsome = new Authsome({mode: test}, context)</span> | ||
| <span class="cstat-no" title="statement not covered" > return authsome.can(user1, 'DELETE', fragment).then(<span class="fstat-no" title="function not covered" >pe</span>rmission => {</span> | ||
| <span class="cstat-no" title="statement not covered" > expect(permission).to.eql(true)</span> | ||
| }) | ||
| }) | ||
| }) | ||
| }) | ||
| </pre></td></tr> | ||
| </table></pre> | ||
| <div class='push'></div><!-- for sticky footer --> | ||
| </div><!-- /wrapper --> | ||
| <div class='footer quiet pad2 space-top1 center small'> | ||
| Code coverage | ||
| generated by <a href="https://istanbul.js.org/" target="_blank">istanbul</a> at Wed Sep 20 2017 12:02:08 GMT+0200 (CEST) | ||
| </div> | ||
| </div> | ||
| <script src="../../../prettify.js"></script> | ||
| <script> | ||
| window.onload = function () { | ||
| if (typeof prettyPrint === 'function') { | ||
| prettyPrint(); | ||
| } | ||
| }; | ||
| </script> | ||
| <script src="../../../sorter.js"></script> | ||
| </body> | ||
| </html> |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
2
-33.33%0
-100%152024
-57.87%15
-62.5%747
-34.99%