Skip to content

Commit

Permalink
Angular Testing
Browse files Browse the repository at this point in the history
- Configure and execute unit tests on Angular components using Jasmine
and Karma
- Configure and execute end-to-end tests using Jasmine and Protractor
  • Loading branch information
yogykwan committed May 14, 2017
1 parent 3f7bfab commit afc5113
Show file tree
Hide file tree
Showing 34 changed files with 280 additions and 3,638 deletions.
33 changes: 33 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,37 @@ npm install gulp --save-dev
npm install jshint gulp-jshint jshint-stylish gulp-imagemin gulp-concat gulp-uglify gulp-minify-css gulp-usemin gulp-cache gulp-changed gulp-rev gulp-rename gulp-notify browser-sync del gulp-ng-annotate --save-dev
gulp
gulp watch
```

# Server

```
npm install json-server -g
cd json-server
json-server --watch db.json
```

# Unit Test

```
npm install jasmine-core --save-dev
npm install karma-cli -g
npm install karma-jasmine --save-dev
npm install phantomjs karma-phantomjs-launcher karma-chrome-launcher --save-dev
cd test
karma start karma.conf.js
```

# E2E Test

```
npm install protractor -g
webdriver-manager update
gulp watch
cd test
protractor protractor.conf.js
```
6 changes: 3 additions & 3 deletions app/scripts/controllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ angular.module('confusionApp')
$scope.showDish = false;
$scope.message = "Loading ...";

$scope.dish = $scope.dish = menuFactory.getDishes().get({id: parseInt($stateParams.id, 10)})
$scope.dish = menuFactory.getDishes().get({id: parseInt($stateParams.id, 10)})
.$promise.then(
function (response) {
$scope.dish = response;
Expand Down Expand Up @@ -122,10 +122,10 @@ angular.module('confusionApp')
$scope.showDish = false;
$scope.message = "Loading ...";

$scope.dish = menuFactory.getDishes.get({id: 0})
$scope.dish = menuFactory.getDishes().get({id: 0})
.$promise.then(
function (response) {
$scope.dish = response.data;
$scope.dish = response;
$scope.showDish = true;
},
function (response) {
Expand Down
3 changes: 2 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"font-awesome": "~4.7.0",
"angular": "~1.6.4",
"angular-ui-router": "~1.0.3",
"angular-resource": "~1.6.4"
"angular-resource": "~1.6.4",
"angular-mocks": "~1.6.4"
}
}
14 changes: 1 addition & 13 deletions json-server/db.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,18 +38,6 @@
"comment": "It's your birthday, we're gonna party!",
"author": "25 Cent",
"date": "2011-12-02T17:57:28.556094Z"
},
{
"author": "yogy",
"rating": 5,
"comment": "test",
"date": "2017-05-13T23:05:57.733Z"
},
{
"author": "Kwan",
"rating": 5,
"comment": "test2",
"date": "2017-05-13T23:07:08.327Z"
}
]
},
Expand Down Expand Up @@ -222,4 +210,4 @@
}
],
"feedback": []
}
}
2,671 changes: 0 additions & 2,671 deletions json-server/public/fonts/fontawesome-webfont.svg

This file was deleted.

Binary file removed json-server/public/fonts/fontawesome-webfont.ttf
Binary file not shown.
Binary file removed json-server/public/fonts/fontawesome-webfont.woff
Binary file not shown.
Binary file removed json-server/public/fonts/fontawesome-webfont.woff2
Binary file not shown.
288 changes: 0 additions & 288 deletions json-server/public/fonts/glyphicons-halflings-regular.svg

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed json-server/public/images/alberto.png
Binary file not shown.
Binary file removed json-server/public/images/buffet.png
Binary file not shown.
Binary file removed json-server/public/images/elaicheesecake.png
Binary file not shown.
Binary file removed json-server/public/images/logo.png
Binary file not shown.
Binary file removed json-server/public/images/uthapizza.png
Binary file not shown.
Binary file removed json-server/public/images/vadonut.png
Binary file not shown.
Binary file removed json-server/public/images/zucchipakoda.png
Binary file not shown.
33 changes: 0 additions & 33 deletions json-server/public/index.html

This file was deleted.

9 changes: 0 additions & 9 deletions json-server/public/scripts/main-8adb482677.js

This file was deleted.

12 changes: 0 additions & 12 deletions json-server/public/styles/main-dfdd57573d.css

This file was deleted.

134 changes: 0 additions & 134 deletions json-server/public/views/aboutus.html

This file was deleted.

Loading

0 comments on commit afc5113

Please sign in to comment.