🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

mcap-application-validation

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mcap-application-validation - npm Package Compare versions

Comparing version
0.0.0
to
0.1.0
+21
.editorconfig
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
# Change these settings to your own preference
indent_style = space
indent_size = 2
# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
{
"requireCurlyBraces": ["if", "else", "for", "while", "do", "try", "catch"],
"requireSpaceAfterKeywords": ["if", "else", "for", "while", "do", "switch", "return", "try", "catch"],
"disallowSpaceBeforeBinaryOperators": [",", ":"],
"disallowSpaceAfterBinaryOperators": ["!"],
"requireSpaceBeforeBinaryOperators": ["?", "+", "-", "/", "*", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"requireSpaceAfterBinaryOperators": ["?", "+", "/", "*", ":", "=", "==", "===", "!=", "!==", ">", ">=", "<", "<="],
"disallowImplicitTypeConversion": ["string"],
"disallowKeywords": ["with"],
"disallowMultipleLineBreaks": true,
"disallowKeywordsOnNewLine": ["else"],
"disallowTrailingWhitespace": true,
"requireLineFeedAtFileEnd": true,
"validateIndentation": 2,
"validateJSDoc": {
"checkParamNames": true,
"requireParamTypes": true
}
}
{
"curly": true,
"eqeqeq": true,
"immed": true,
"latedef": true,
"newcap": true,
"noarg": true,
"sub": true,
"undef": true,
"unused": true,
"boss": true,
"eqnull": true,
"node": true,
"globals": {
"describe" : false,
"it" : false,
"before" : false,
"beforeEach" : false,
"after" : false,
"afterEach" : false
}
}
language: node_js
node_js:
- '0.10'
after_script:
- npm run coveralls
# 0.1.0 (2014-10-06)
- Initial version
var ApplicationValidation = require('./');
var validation = new ApplicationValidation();
validation.run('./test/fixtures/validation_error', function(err) {
if (err) {
return console.log(err.details);
}
console.log('Project is valid!');
});
'use strict';
var gulp = require('gulp');
var plugins = require('gulp-load-plugins')();
var paths = {
lint: ['./gulpfile.js', './lib/**/*.js'],
watch: ['./gulpfile.js', './lib/**', './test/**/*.js', '!test/{temp,temp/**}', '!test/fixtures/**'],
tests: ['./test/**/*.js', '!test/{temp,temp/**}', '!test/fixtures/**'],
source: ['./lib/*.js']
};
gulp.task('lint', function () {
return gulp.src(paths.lint)
.pipe(plugins.jshint('.jshintrc'))
.pipe(plugins.plumber())
.pipe(plugins.jscs())
.pipe(plugins.jshint.reporter('jshint-stylish'));
});
gulp.task('istanbul', function (cb) {
gulp.src(paths.source)
.pipe(plugins.istanbul()) // Covering files
.on('finish', function () {
gulp.src(paths.tests)
.pipe(plugins.plumber())
.pipe(plugins.mocha())
.pipe(plugins.istanbul.writeReports()) // Creating the reports after tests runned
.on('finish', function() {
process.chdir(__dirname);
cb();
});
});
});
gulp.task('bump', ['test'], function () {
var bumpType = plugins.util.env.type || 'patch'; // major.minor.patch
return gulp.src(['./package.json'])
.pipe(plugins.bump({ type: bumpType }))
.pipe(gulp.dest('./'));
});
gulp.task('watch', ['test'], function () {
gulp.watch(paths.watch, ['test']);
});
gulp.task('test', ['lint', 'istanbul']);
gulp.task('release', ['bump']);
gulp.task('default', ['test']);
var fs = require('fs');
var path = require('path');
var gulp = require('gulp');
var jsonlint = require("gulp-jsonlint");
var validate = require('./tasks/validate');
var mcapManifest = require('./validators/mcapManifest.js');
var mcapModels = require('./validators/mcapModels.js');
var ApplicationValidation = function() {
this.jsonLinstMessages = [];
this.validateMessages = [];
};
ApplicationValidation.prototype.setupGulp = function(projectRoot) {
var that = this;
var jsonLintReporter = function (file) {
that.jsonLinstMessages.push({
file: file.relative,
message: file.jsonlint.message
});
};
var validateReporter = function (file) {
that.validateMessages.push({
file: file.relative,
message: file.validate.message
});
};
gulp.task('lint', function(cb) {
gulp.src('**/*.json', {cwd:projectRoot})
// Lint json files
.pipe(jsonlint())
.pipe(jsonlint.reporter(jsonLintReporter))
.on('end', function() {
if (that.jsonLinstMessages.length) {
var error = new Error();
error.name = 'LintError';
error.details = that.jsonLinstMessages;
return cb(error);
}
cb(null);
});
});
gulp.task('mcapManifest', ['lint'], function(cb) {
gulp.src('**/*.json', {cwd:projectRoot})
// Validate manifest file
.pipe(mcapManifest.filter)
.pipe(validate(mcapManifest))
.pipe(validate.reporter(validateReporter))
.pipe(mcapManifest.filter.restore())
// Validate model files
.pipe(mcapModels.filter)
.pipe(validate(mcapModels))
.pipe(validate.reporter(validateReporter))
.pipe(mcapModels.filter.restore())
.on('finish', function() {
if (that.validateMessages.length) {
var error = new Error();
error.name = 'ValidateError';
error.details = that.validateMessages;
return cb(error);
}
cb(null);
});
});
gulp.task('default', ['mcapManifest']);
};
ApplicationValidation.prototype.run = function(basePath, cb) {
// Check if folder is present
fs.stat(basePath, function(err) {
if (err) {
return cb(err);
}
// Check if folder contains a mcap.json file
fs.stat(path.resolve(basePath, 'mcap.json'), function(err) {
if (err) {
if (err.code === 'ENOENT') {
return cb(new Error('Missing mcap.json file'));
}
return cb(err);
}
this.setupGulp(basePath);
gulp.run('default', function(err) {
cb(err);
});
}.bind(this));
}.bind(this));
};
module.exports = ApplicationValidation;
var _ = require('lodash');
var gutil = require('gulp-util');
var c = gutil.colors;
var Joi = require('joi');
var mapStream = require('map-stream');
var Validate = function(jobDescription) {
return mapStream(function (file, cb) {
var content = null;
try {
content = JSON.parse(String(file.contents));
} catch (err) {
return cb(err);
}
var options = {
abortEarly: false
};
_.defaults(options, jobDescription.options);
Joi.validate(content, jobDescription.schema, options, function (err) {
if (err) {
file.validate = err;
file.validate.success = false;
}
cb(null, file);
}.bind(this));
});
};
var defaultReporter = function(file) {
gutil.log(c.yellow('Error on file ') + c.magenta(file.path));
gutil.log(c.red(file.validate));
};
Validate.reporter = function (customReporter) {
var reporter = defaultReporter;
if (typeof customReporter === 'function') {
reporter = customReporter;
}
return mapStream(function (file, cb) {
if (file.validate && !file.validate.success) {
reporter(file);
}
return cb(null, file);
});
};
module.exports = Validate;
var gulpFilter = require('gulp-filter');
var Joi = require('joi');
module.exports = {
filter: gulpFilter('mcap*.json'),
schema: Joi.object().keys({
name: Joi.string().required().alphanum().min(3).max(30),
uuid: Joi.string().required().regex(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/),
baseAlias: Joi.string().required().regex(/^\//).min(3).max(30)
}),
options: {
allowUnknown: true
}
};
var gulpFilter = require('gulp-filter');
var Joi = require('joi');
module.exports = {
filter: gulpFilter('models/*.json'),
schema: Joi.object().keys({
name: Joi.string().required().alphanum().min(3).max(30),
label: Joi.string().required().alphanum().min(3).max(30),
attributes: Joi.object().required()
}),
options: {
allowUnknown: false
}
};
# This isn't a mCAP project

Sorry, the diff of this file is not supported yet

Changelog
v0.1.0

Sorry, the diff of this file is not supported yet

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>gulpapp</title>
<!-- Template: helloworld -->
<link href="lib/ionic/css/ionic.css" rel="stylesheet">
<link href="css/style.css" rel="stylesheet">
<script src="js/mcapconfig.js"></script>
<!-- IF using Sass (run gulp sass first), then uncomment below and remove the CSS includes above
<link href="css/ionic.app.css" rel="stylesheet">
-->
<!-- ionic/angularjs js -->
<script src="lib/ionic/js/ionic.bundle.js"></script>
<!-- mcapjs-client/mcap js -->
<script src="lib/underscore/underscore.js"></script>
<script src="lib/jquery/jquery.js"></script>
<script src="lib/backbone/backbone.js"></script>
<script src="lib/uri.js/URI.js"></script>
<script src="lib/mcapjs-client/mcap.js"></script>
<script src="lib/socket.io-client/socket.io.js"></script>
<script src="lib/bikini/bikini.js"></script>
<script src="modules/todos/todos.js"></script>
<script src="modules/todos/bikini/Models/todos_model.js"></script>
<script src="modules/todos/bikini/Collections/todos_collection.js"></script>
<script src="modules/todos/directives/todos_directive.js"></script>
<script src="modules/todos/services/todos_service.js"></script>
<script src="modules/todos/controllers/todos_ctrl.js"></script>
<script src="modules/todos/controllers/todos_detail_ctrl.js"></script>
<script src="modules/todos/controllers/todos_edit_ctrl.js"></script>
<script src="modules/todos/controllers/todos_new_ctrl.js"></script>
<!-- your app's js -->
<script src="js/app.js"></script>
<script src="js/controllers.js"></script>
</head>
<body ng-app="starter" animation="slide-left-right-ios7">
<!--
The nav bar that will be updated as we navigate between views.
-->
<ion-nav-bar class="bar-stable nav-title-slide-ios7">
<ion-nav-back-button class="button-icon icon ion-chevron-left">
Back
</ion-nav-back-button>
</ion-nav-bar>
<!--
The views will be rendered in the <ion-nav-view> directive below
Templates are in the /templates folder (but you could also
have templates inline in this html file if you'd like).
-->
<ion-nav-view></ion-nav-view>
</body>
</html>
// Ionic Starter App
// angular.module is a global place for creating, registering and retrieving Angular modules
// 'starter' is the name of this angular module example (also set in a <body> attribute in index.html)
// the 2nd parameter is an array of 'requires'
// 'starter.services' is found in services.js
// 'starter.controllers' is found in controllers.js
var dependencies = ['ionic', 'starter.controllers'];
dependencies.push('todos');
//mcap:dependencies
angular.module('starter', dependencies)
.run(function($ionicPlatform) {
$ionicPlatform.ready(function() {
if(window.StatusBar) {
// org.apache.cordova.statusbar required
StatusBar.styleDefault();
}
});
})
.config(function($stateProvider, $urlRouterProvider) {
// Ionic uses AngularUI Router which uses the concept of states
// Learn more here: https://github.com/angular-ui/ui-router
// Set up the various states which the app can be in.
// Each state's controller can be found in controllers.js
$stateProvider
// setup an abstract state for the tabs directive
.state('tab', {
url: "/tab",
abstract: true,
templateUrl: "templates/tabs.html"
})
// Each tab has its own nav history stack:
.state('tab.home', {
url: '/home',
views: {
'tab-home': {
templateUrl: 'templates/tab-home.html',
controller: 'HomeCtrl'
}
}
})
.state('tab.info', {
url: '/info',
views: {
'tab-info': {
templateUrl: 'templates/tab-info.html',
controller: 'InfoCtrl'
}
}
})
.state('tab.todos', {
url: '/todos',
views: {
'tab-home': {
templateUrl: 'modules/todos/views/todos_list.html',
controller: 'TodosCtrl'
}
}
})
.state('tab.todosNew', {
url: '/todos/new',
views: {
'tab-home': {
templateUrl: 'modules/todos/views/todos_edit.html',
controller: 'TodosCtrlNew'
}
}
})
.state('tab.todosDetail', {
url: '/todos/:todoId',
views: {
'tab-home': {
templateUrl: 'modules/todos/views/todos_detail.html',
controller: 'TodosCtrlDetail'
}
}
})
.state('tab.todosEdit', {
url: '/todos/:todoId/edit',
views: {
'tab-home': {
templateUrl: 'modules/todos/views/todos_edit.html',
controller: 'TodosCtrlEdit'
}
}
})
//mcap:router
// if none of the above states are matched, use this as the fallback
$urlRouterProvider.otherwise('/tab/home');
});
<!--
Create tabs with an icon and label, using the tabs-positive style.
Each tab's child <ion-nav-view> directive will have its own
navigation history that also transitions its views in and out.
-->
<ion-tabs class="tabs-icon-top">
<!-- Pets Tab -->
<ion-tab title="Home" icon="icon ion-home" href="#/tab/home">
<ion-nav-view name="tab-home"></ion-nav-view>
</ion-tab>
<!-- About Tab -->
<ion-tab title="About" icon="icon ion-information-circled" href="#/tab/info">
<ion-nav-view name="tab-info"></ion-nav-view>
</ion-tab>
</ion-tabs>
{
"uuid": "110ec58a-a0f2-4ac4-8393-c866d813b8d1",
"name": "app1",
"baseAlias": "/app1"
}
{
"name": "To2do",
"label": "Todo",
"attributes": {
"title": {
"type": "String",
"mandatory": true,
"key": false
},
"order": {
"type": "Integer",
"mandatory": false,
"key": false
},
"completed": {
"type": "Boolean",
"mandatory": false,
"key": false
},
"_id": {
"type": "String",
"mandatory": true,
"key": true
}
}
}
{
"name": "To2do",
"label": "Todo",
"attributes": {
"title": {
"type": "String",
"mandatory": true,
"key": false
},
"order": {
"type": "Integer",
"mandatory": false,
"key": false
},
"completed": {
"type": "Boolean",
"mandatory": false,
"key": false
},
"_id": {
"type": "String",
"mandatory": true,
"key": true
}
}
}
{
"name": "To2do",
"label": "Todo",
"attributes": {
"title": {
"type": "String",
"mandatory": true,
"key": false
},
"order": {
"type": "Integer",
"mandatory": false,
"key": false
},
"completed": {
"type": "Boolean",
"mandatory": false,
"key": false
},
"_id": {
"type": "String",
"mandatory": true,
"key": true
}
}
}
{
"name": "heinz",
"email": "heinz@mailserver.com"
}
// var express = require('mcap/express.js');
var express = require('express');
var app = express();
var gulp = require('gulp');
app.use(express.bodyParser());
/**
* lists all available API.
*/
app.get('/', function( req, res ) {
gulp.task('copy', function() {
return gulp.src('./files/**')
.pipe(gulp.dest('./dest/'));
});
gulp.run('copy', function() {
res.send(arguments);
});
});
//starts express webserver
app.listen(8080);
{
"name": "gulpapp",
"version": "0.0.0",
"description": "",
"main": "index.js",
"author": "",
"license": "MIT",
"dependencies": {
"express": "^3.0.6",
"gulp": "^3.8.8"
}
}
'use strict';
/*jshint expr: true*/
var ApplicationValidation = require('../');
require('should');
var path = require('path');
describe('mcapApplicationValidation', function () {
var validation;
beforeEach(function() {
process.chdir(path.resolve(__dirname, 'fixtures/'));
validation = new ApplicationValidation();
});
it('unkown folder', function (cb) {
validation.run('./unkown-folder', function(err) {
err.should.be.defined;
cb();
});
});
it('not mcap project', function (cb) {
validation.run('./no_project', function(err) {
err.should.be.defined;
err.message.should.be.eql('Missing mcap.json file');
cb();
});
});
it('lint errors', function (cb) {
validation.run('./lint_error/', function(err) {
err.should.be.defined;
err.name.should.be.eql('LintError');
err.details.should.be.defined;
err.details.should.be.instanceOf(Array);
err.details.should.be.length(2);
err.details[0].should.be.type('object');
err.details[0].file.should.be.type('string');
err.details[0].message.should.be.type('string');
cb();
});
});
it('validation errors', function (cb) {
validation.run('./validation_error/', function(err) {
err.should.be.defined;
err.name.should.be.eql('ValidateError');
err.details.should.be.defined;
err.details.should.be.instanceOf(Array);
err.details.should.be.length(2);
err.details[0].should.be.type('object');
err.details[0].file.should.be.type('string');
err.details[0].message.should.be.type('string');
cb();
});
});
it('pass', function (cb) {
validation.run('./passes/', function(err) {
(err === null).should.be.true;
cb();
});
});
});
+31
-14
{
"name": "mcap-application-validation",
"version": "0.0.0",
"description": "Validate a mCAP Application",
"main": "index.js",
"scripts": {
"test": "tap test/*.js"
"description": "Validate a mCAP application",
"version": "0.1.0",
"homepage": "https://github.com/mwaylabs/mcap-application-validation",
"bugs": "https://github.com/mwaylabs/mcap-application-validation/issues",
"license": "MIT",
"main": "lib/index.js",
"author": {
"name": "mwaylabs"
},
"repository": {
"type": "git",
"url": "git://github.com/mwaylabs/mcap-application-validation.git"
"url": "https://github.com/mwaylabs/mcap-application-validation"
},
"author": "mwaylabs",
"license": "MIT",
"bugs": {
"url": "https://github.com/mwaylabs/mcap-application-validation/issues"
"keywords": [],
"dependencies": {
"gulp-util": "^3.0.1",
"gulp": "^3.8.8",
"gulp-filter": "^1.0.2",
"gulp-jsonlint": "^0.1.0",
"joi": "^4.7.0",
"lodash": "^2.4.1",
"map-stream": "^0.1.0"
},
"homepage": "https://github.com/mwaylabs/mcap-application-validation",
"devDependencies": {
"tap": "^0.4.12"
"gulp-bump": "^0.1.11",
"gulp-jscs": "^1.1.2",
"gulp-jshint": "^1.8.4",
"gulp-mocha": "^1.1.0",
"gulp-istanbul": "^0.3.0",
"coveralls": "^2.11.1",
"should": "^4.0.4",
"jshint-stylish": "^0.4.0",
"gulp-load-plugins": "^0.6.0",
"gulp-plumber": "^0.6.5"
},
"dependencies": {
"jsonlint": "^1.6.0"
"scripts": {
"coveralls": "gulp test && cat coverage/lcov.info | ./node_modules/coveralls/bin/coveralls.js",
"test": "gulp test"
}
}
+32
-13

@@ -1,23 +0,42 @@

# mCAP Application Validation
# mcap-application-validation
[![NPM version][npm-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Dependency Status][daviddm-url]][daviddm-image] [![Coverage Status][coveralls-image]][coveralls-url]
Validate a mCAP Application.
Validate a mCAP application
## Install
```bash
$ npm install --save mcap-application-validation
```
git clone https://github.com/mwaylabs/mcap-application-validation.git
cd mcap-application-validation
npm install
```
or
## Usage
```javascript
var ApplicationValidation = require('mcap-application-validation');
var validation = new ApplicationValidation();
validation.run('./test/fixtures/passes', function(err) {
if (err) {
return console.log(err.details);
}
console.log('Project is valid!');
});
```
npm install mcap-application-validation
```
## Test
## License
```
tap test/*.js
```
Copyright (c) 2014 M-Way Solutions GmbH. Licensed under the MIT license.
[npm-url]: https://npmjs.org/package/mcap-application-validation
[npm-image]: https://badge.fury.io/js/mcap-application-validation.svg
[travis-url]: https://travis-ci.org/mwaylabs/mcap-application-validation
[travis-image]: https://travis-ci.org/mwaylabs/mcap-application-validation.svg?branch=master
[daviddm-url]: https://david-dm.org/mwaylabs/mcap-application-validation.svg?theme=shields.io
[daviddm-image]: https://david-dm.org/mwaylabs/mcap-application-validation
[coveralls-url]: https://coveralls.io/r/mwaylabs/mcap-application-validation
[coveralls-image]: https://coveralls.io/repos/mwaylabs/mcap-application-validation/badge.png
## 0.0.0 - 2014-07-29
- initial implementation
var path = require('path');
var fs = require('fs');
var jsonlint = require('jsonlint');
/**
* Return the path to the mcap.json
* @param applicationPath
* @returns {string|URIComponents|*}
* @private
*/
function _getMcapJsonPath(applicationPath) {
return path.normalize(applicationPath + '/mcap.json');
}
/**
* Check if application path is present
* @param applicationPath
* @param error
* @private
*/
function _pathExists(applicationPath, error) {
if (!fs.existsSync(applicationPath)) {
error.ERROR_0 = module.exports.ERROR_0;
}
}
/**
* Check if mcap.json is present
* @param applicationPath
* @param error
* @private
*/
function _mcapJsonExists(applicationPath, error) {
if (!fs.existsSync(_getMcapJsonPath(applicationPath))) {
error.ERROR_1 = module.exports.ERROR_1;
}
}
/**
* Validate the mcap.json file
* @param applicationPath
* @param error
* @private
*/
function _mCAPJsonValid(applicationPath, error) {
try {
var mcapJson = fs.readFileSync(_getMcapJsonPath(applicationPath), 'utf-8');
return jsonlint.parse(mcapJson);
} catch (e) {
error.ERROR_2 = module.exports.ERROR_2;
error.ERROR_2.info = e;
}
}
function _mCAPJsonRequiredFields(applicationPath, error) {
var mcapJson = _mCAPJsonValid(applicationPath, error);
if (mcapJson) {
if (!mcapJson.uuid) {
error.ERROR_3 = module.exports.ERROR_3
}
if (!mcapJson.name) {
error.ERROR_4 = module.exports.ERROR_4
}
}
}
/**
* Validate the given path to match all mCAP application dependencies
* @param path
*/
function validate(applicationPath) {
var error = {};
_pathExists(applicationPath, error);
_mcapJsonExists(applicationPath, error);
_mCAPJsonValid(applicationPath, error);
_mCAPJsonRequiredFields(applicationPath, error);
if (Object.keys(error).length === 0) {
return true;
}
return error;
}
// API
module.exports.validate = validate;
module.exports.ERROR_0 = {
en: 'Path does not exists'
};
module.exports.ERROR_1 = {
en: 'mcap.json is missing'
};
module.exports.ERROR_2 = {
en: 'mcap.json is invalid'
};
module.exports.ERROR_3 = {
en: 'mcap.json uuid is required'
};
module.exports.ERROR_4 = {
en: 'mcap.json name is required'
};
{
uuid: 110ec58a-a0f2-4ac4-8393-c866d813b8d1,
name: app1
}
{
"uuid": "110ec58a-a0f2-4ac4-8393-c866d813b8d1"
}
{
"uuid": "110ec58a-a0f2-4ac4-8393-c866d813b8d1",
"name": "app1"
}
'use strict';
var tap = require('tap');
var mCAPApplicationValidatior = require('../index');
tap.test('programm', function (t) {
t.ok(mCAPApplicationValidatior, "object loaded");
t.ok(mCAPApplicationValidatior.validate, "function present");
t.end();
});
tap.test('constants', function (t) {
t.ok(mCAPApplicationValidatior.ERROR_0);
t.deepEqual(mCAPApplicationValidatior.ERROR_0, {
en: 'Path does not exists'
});
t.ok(mCAPApplicationValidatior.ERROR_1);
t.deepEqual(mCAPApplicationValidatior.ERROR_1, {
en: 'mcap.json is missing'
});
t.ok(mCAPApplicationValidatior.ERROR_2);
t.deepEqual(mCAPApplicationValidatior.ERROR_2, {
en: 'mcap.json is invalid'
});
t.ok(mCAPApplicationValidatior.ERROR_3);
t.deepEqual(mCAPApplicationValidatior.ERROR_3, {
en: 'mcap.json uuid is required'
});
t.ok(mCAPApplicationValidatior.ERROR_4);
t.deepEqual(mCAPApplicationValidatior.ERROR_4, {
en: 'mcap.json name is required'
});
t.end();
});
tap.test('validate', function (t) {
t.equal(mCAPApplicationValidatior.validate(__dirname + '/passes/app1'), true);
t.end();
});
tap.test('validate fail: path does not exists', function (t) {
var app = mCAPApplicationValidatior.validate(__dirname + '/fails/00_not_app');
t.equal(typeof app, 'object');
t.ok(app.ERROR_0);
t.ok(app.ERROR_1);
t.ok(app.ERROR_2);
t.end();
});
tap.test('validate fail: not an application', function (t) {
var app = mCAPApplicationValidatior.validate(__dirname + '/fails/01_not_app');
t.equal(typeof app, 'object');
t.ok(app.ERROR_1);
t.ok(app.ERROR_2);
t.end();
});
tap.test('validate fail: mcap.json parse error', function (t) {
var app = mCAPApplicationValidatior.validate(__dirname + '/fails/02_mcapjson_parse_error');
t.equal(typeof app, 'object');
t.ok(app.ERROR_2);
t.end();
});
tap.test('validate fail: mcap.json uuid required', function (t) {
var app = mCAPApplicationValidatior.validate(__dirname + '/fails/03_uuid_required');
t.equal(typeof app, 'object');
t.ok(app.ERROR_3);
t.end();
});
tap.test('validate fail: mcap.json name required', function (t) {
var app = mCAPApplicationValidatior.validate(__dirname + '/fails/04_name_required');
t.equal(typeof app, 'object');
t.ok(app.ERROR_4);
t.end();
});
tap.test('validate fail: mcap.json uuid and name required', function (t) {
var app = mCAPApplicationValidatior.validate(__dirname + '/fails/05_uuid_name_required');
t.equal(typeof app, 'object');
t.ok(app.ERROR_3);
t.ok(app.ERROR_4);
t.end();
});

Sorry, the diff of this file is not supported yet