Browse Source

d3 ex

master
Ganesh 5 years ago
parent
commit
e7c46a9062
2 changed files with 74 additions and 3 deletions
  1. 9
      jasmine-async-await/unit-tests/js-3.6.0/spec/spyjasminespec.js
  2. 68
      tomastrajan/package.json

9
jasmine-async-await/unit-tests/js-3.6.0/spec/spyjasminespec.js

@ -4,10 +4,13 @@ describe("Example Of jasmine Spy using spyOn()", function() {
var dictionary = new Dictionary;
var person = new Person;
spyOn(dictionary, "hello"); // replace hello function with a spy
spyOn(dictionary, "world"); // replace world function with another spy
spyOn(dictionary, "hello"); //.and.returnValue('hello'); // replace hello function with a spy
//console.log(r);
spyOn(dictionary, "world").and.returnValue('worcld'); // replace world function with another spy
person.sayHelloWorld(dictionary);
var retval = person.sayHelloWorld(dictionary);
console.log(retval);
expect(retval).toBe('hello world');
expect(dictionary.hello).toHaveBeenCalled();
// not possible without first spy

68
tomastrajan/package.json

@ -0,0 +1,68 @@
{
"name": "angular-js-es6-testing-example",
"version": "1.0.0",
"description": "Enhanced testing of Angular JS 1.X applications using ES6 modules",
"main": "src/app.js",
"scripts": {
"start": "cross-env NODE_ENV=DEV webpack-dev-server",
"build": "webpack --display-chunks --display-reasons --display-error-details --display-modules",
"dist": "cross-env NODE_ENV=DIST webpack",
"server_build": "node server.js",
"server_dist": "cross-env NODE_ENV=DIST node server.js",
"lint": "eslint src/",
"mocha": "mocha --compilers js:babel-register ./src/**/*.test.js",
"watch": "mocha --compilers js:babel-register -w ./src/**/*.test.js",
"karma": "karma start",
"test": "npm run lint && npm run mocha && karma start --single-run",
"ci": "npm run lint && npm run mocha && npm run dist"
},
"author": "tomas.trajan@gmail.com",
"license": "ISC",
"dependencies": {
"angular": "1.8.1",
"angular-animate": "1.8.1",
"angular-ui-bootstrap": "2.5.6",
"angular-ui-router": "1.0.28",
"bootstrap": "3.3.5",
"jquery": "2.1.4",
"lodash": "3.10.1"
},
"devDependencies": {
"angular-mocks": "1.5",
"awesome-typescript-loader": "0.11.3",
"babel-core": "^6.26.3",
"babel-loader": "6.2.1",
"babel-plugin-transform-runtime": "6.4.3",
"babel-preset-es2015": "6.3.13",
"babel-register": "^6.26.0",
"babel-runtime": "6.5",
"chai": "3.2.0",
"chalk": "1.1.0",
"clean-webpack-plugin": "0.1.3",
"connect": "^3.6.6",
"cross-env": "^3.1.3",
"css-loader": "0.15.6",
"eslint": "1.10.3",
"eslint-config-defaults": "8.0.2",
"file-loader": "0.8.4",
"html-loader": "^0.5.5",
"html-webpack-plugin": "2.24.1",
"jasmine-core": "2.3.4",
"karma": "4.0.1",
"karma-chrome-launcher": "3.1.0",
"karma-jasmine": "^4.0.1",
"karma-mocha-reporter": "1.1.1",
"karma-webpack": "1.7.0",
"minimist": "1.1.3",
"mocha": "2.2.5",
"ngtemplate-loader": "1.3.0",
"open-browser-webpack-plugin": "0.0.5",
"serve-static": "^1.13.2",
"sinon": "1.17.1",
"style-loader": "0.12.3",
"typescript": "1.5.3",
"url-loader": "0.5.6",
"webpack": "1.10.5",
"webpack-dev-server": "1.10.1"
}
}
Loading…
Cancel
Save