From e7c46a9062eec4560368dd004eecd03d362bd137 Mon Sep 17 00:00:00 2001 From: Ganesh Date: Thu, 22 Oct 2020 18:29:50 +0530 Subject: [PATCH] d3 ex --- .../js-3.6.0/spec/spyjasminespec.js | 9 ++- tomastrajan/package.json | 68 +++++++++++++++++++ 2 files changed, 74 insertions(+), 3 deletions(-) create mode 100644 tomastrajan/package.json diff --git a/jasmine-async-await/unit-tests/js-3.6.0/spec/spyjasminespec.js b/jasmine-async-await/unit-tests/js-3.6.0/spec/spyjasminespec.js index db684b9..84aeec3 100755 --- a/jasmine-async-await/unit-tests/js-3.6.0/spec/spyjasminespec.js +++ b/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 diff --git a/tomastrajan/package.json b/tomastrajan/package.json new file mode 100644 index 0000000..f48d873 --- /dev/null +++ b/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" + } +}