all files / unit/ DemoNodeTest.js

82.86% Statements 58/70
38.89% Branches 7/18
72.73% Functions 16/22
83.02% Lines 44/53
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                                                                                                                 10×   10×   10× 10×   10×                                                                      
/******/ (function(modules) { // webpackBootstrap
/******/ 	// The module cache
/******/ 	var installedModules = {};
/******/
/******/ 	// The require function
/******/ 	function __webpack_require__(moduleId) {
/******/
/******/ 		// Check if module is in cache
/******/ 		Iif(installedModules[moduleId]) {
/******/ 			return installedModules[moduleId].exports;
/******/ 		}
/******/ 		// Create a new module (and put it into the cache)
/******/ 		var module = installedModules[moduleId] = {
/******/ 			i: moduleId,
/******/ 			l: false,
/******/ 			exports: {}
/******/ 		};
/******/
/******/ 		// Execute the module function
/******/ 		modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ 		// Flag the module as loaded
/******/ 		module.l = true;
/******/
/******/ 		// Return the exports of the module
/******/ 		return module.exports;
/******/ 	}
/******/
/******/
/******/ 	// expose the modules object (__webpack_modules__)
/******/ 	__webpack_require__.m = modules;
/******/
/******/ 	// expose the module cache
/******/ 	__webpack_require__.c = installedModules;
/******/
/******/ 	// define getter function for harmony exports
/******/ 	__webpack_require__.d = function(exports, name, getter) {
/******/ 		if(!__webpack_require__.o(exports, name)) {
/******/ 			Object.defineProperty(exports, name, {
/******/ 				configurable: false,
/******/ 				enumerable: true,
/******/ 				get: getter
/******/ 			});
/******/ 		}
/******/ 	};
/******/
/******/ 	// getDefaultExport function for compatibility with non-harmony modules
/******/ 	__webpack_require__.n = function(module) {
/******/ 		var getter = module && module.__esModule ?
/******/ 			function getDefault() { return module['default']; } :
/******/ 			function getModuleExports() { return module; };
/******/ 		__webpack_require__.d(getter, 'a', getter);
/******/ 		return getter;
/******/ 	};
/******/
/******/ 	// Object.prototype.hasOwnProperty.call
/******/ 	__webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ 	// __webpack_public_path__
/******/ 	__webpack_require__.p = "/_karma_webpack_/";
/******/
/******/ 	// Load entry module and return exports
/******/ 	return __webpack_require__(__webpack_require__.s = 3);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
 
"use strict";
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; Eif ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { Eif (protoProps) defineProperties(Constructor.prototype, protoProps); Iif (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
 
function _classCallCheck(instance, Constructor) { Iif (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
 
var DemoFile = function () {
  function DemoFile(data) {
    _classCallCheck(this, DemoFile);
 
    this.path = '';
    this.component = {};
 
    Object.assign(this, data);
  }
 
  _createClass(DemoFile, [{
    key: 'getFilename',
    value: function getFilename() {
      return this.path.split('/').pop();
    }
  }, {
    key: 'getParentFolderPath',
    value: function getParentFolderPath() {
      return this.path.split('/').slice(0, -1).join('/');
    }
  }, {
    key: 'toJson',
    value: function toJson() {
      return this.path;
    }
  }]);
 
  return DemoFile;
}();
 
/* harmony default export */ __webpack_exports__["a"] = (DemoFile);
 
/***/ }),
/* 1 */,
/* 2 */,
/* 3 */
/***/ (function(module, __webpack_exports__, __webpack_require__) {
 
"use strict";
Object.defineProperty(__webpack_exports__, "__esModule", { value: true });
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__src_classes_Main_DemoFile_js__ = __webpack_require__(0);
 
 
describe('DemoNode', function () {
  it('is initialized', function () {
    var node = new __WEBPACK_IMPORTED_MODULE_0__src_classes_Main_DemoFile_js__["a" /* default */]();
    expect(node.path).toBe('');
  });
  it('getParentFolder', function () {
    var node = new __WEBPACK_IMPORTED_MODULE_0__src_classes_Main_DemoFile_js__["a" /* default */]({ path: 'one/two/file.js' });
    expect(node.getParentFolderPath()).toBe('one/two');
    var rootNode = new __WEBPACK_IMPORTED_MODULE_0__src_classes_Main_DemoFile_js__["a" /* default */]({ path: 'file.js' });
    expect(rootNode.getParentFolderPath()).toBe('');
  });
  it('getFileName', function () {
    var node = new __WEBPACK_IMPORTED_MODULE_0__src_classes_Main_DemoFile_js__["a" /* default */]({ path: 'one/two/file.js' });
    expect(node.getFilename()).toBe('file.js');
    var rootNode = new __WEBPACK_IMPORTED_MODULE_0__src_classes_Main_DemoFile_js__["a" /* default */]({ path: 'file.js' });
    expect(rootNode.getFilename()).toBe('file.js');
  });
});
 
/***/ })
/******/ ]);