Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions dan-stineback/.eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
**/node_modules/*
**/vendor/*
**/*.min.js
**/build/*
**/test/*_bundle*
*.md
package.json
45 changes: 45 additions & 0 deletions dan-stineback/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
{
"rules": {
"no-console": 0,
"indent": [
2,
2,
{
"SwitchCase": 1
}
],
"quotes": [
2,
"single"
],
"linebreak-style": [
2,
"unix"
],
"semi": [
2,
"always"
]
},
"env": {
"es6": true,
"node": true,
"browser": true,
"mocha": true,
"jasmine": true
},
"globals": {
"describe": false,
"it": false,
"beforeEach": false,
"afterEach": false,
"before": false,
"after": false
},
"ecmaFeatures": {
"modules": true,
"experimentalObjectRestSpread": true,
"impliedStrict": true
},
"extends": "eslint:recommended"
}
106 changes: 106 additions & 0 deletions dan-stineback/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@

# Created by https://www.gitignore.io/api/node,osx,windows,vim

/build/*
/db
### Node ###
# Logs
logs
*.log
npm-debug.log*

# Runtime data
pids
*.pid
*.seed

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage

# nyc test coverage
.nyc_output

# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# node-waf configuration
.lock-wscript

# Compiled binary addons (http://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules
jspm_packages

# Optional npm cache directory
.npm

# Optional REPL history
.node_repl_history


### OSX ###
*.DS_Store
.AppleDouble
.LSOverride

# Icon must end with two \r
Icon


# Thumbnails
._*

# Files that might appear in the root of a volume
.DocumentRevisions-V100
.fseventsd
.Spotlight-V100
.TemporaryItems
.Trashes
.VolumeIcon.icns
.com.apple.timemachine.donotpresent

# Directories potentially created on remote AFP share
.AppleDB
.AppleDesktop
Network Trash Folder
Temporary Items
.apdisk


### Windows ###
# Windows image file caches
Thumbs.db
ehthumbs.db

# Folder config file
Desktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msm
*.msp

# Windows shortcuts
*.lnk


### Vim ###
# swap
[._]*.s[a-w][a-z]
[._]s[a-w][a-z]
# session
Session.vim
# temporary
.netrwhist
*~
# auto-generated tag files
tags
17 changes: 17 additions & 0 deletions dan-stineback/app/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<!doctype html>
<html>

<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title></title>
</head>

<body>


<script src="bundle.js"></script>
</body>

</html>
5 changes: 5 additions & 0 deletions dan-stineback/app/js/client.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const angular = require('angular');

var FirstApp = angular.module('FirstApp', []);
require('./services')(FirstApp);
require('./controller')(FirstApp);
6 changes: 6 additions & 0 deletions dan-stineback/app/js/controller/error_controller.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
'use strict';
module.exports = function(app) {
app.controller('errorController', function(ErrorService) {
this.errors = ErrorService.getErrors();
});
};
4 changes: 4 additions & 0 deletions dan-stineback/app/js/controller/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict';
module.exports = function(app) {
require('./error_controller')(app);
};
20 changes: 20 additions & 0 deletions dan-stineback/app/js/services/error_services.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
'use strict';

module.exports = function(app) {
app.factory('ErrorService', function() {
const errors = [];
const service = {};

service.logErorr = function(message) {
return function(err) {
errors.push(message);
console.log(err);

};
};
service.getErrors = function() {
return errors;
};
return service;
});
};
4 changes: 4 additions & 0 deletions dan-stineback/app/js/services/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
'use strict';
module.exports = function(app) {
require('./error_services')(app);
};
32 changes: 32 additions & 0 deletions dan-stineback/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
const gulp = require('gulp');
const del = require('del');
const webpack = require('webpack-stream');

const paths = {
html: './app/**/*.html',
js: './app/js/client.js',
tests: './test/error_services_test.js'
};

gulp.task('bundle', ['clean'], () => {
return gulp.src(paths.js)
.pipe(webpack({output:{filename: 'bundle.js'}}))
.pipe(gulp.dest('build'));
});

gulp.task('clean', () => {
return del('./build/**/*');
});

gulp.task('copy', ['clean'],() => {
return gulp.src(paths.html)
.pipe(gulp.dest('./build'));
});

gulp.task('bundle:test', () => {
return gulp.src(paths.tests)
.pipe(webpack({output:{filename: 'test_bundle.js'}}))
.pipe(gulp.dest('./test'));
});

gulp.task('default', ['bundle', 'clean', 'copy']);
69 changes: 69 additions & 0 deletions dan-stineback/karma.conf.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Karma configuration
// Generated on Wed Jun 08 2016 13:49:50 GMT-0700 (PDT)

module.exports = function(config) {
config.set({

// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',


// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['jasmine'],


// list of files / patterns to load in the browser
files: [
'test/*_bundle.js'
],


// list of files to exclude
exclude: [
],


// preprocess matching files before serving them to the browser
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
preprocessors: {
},


// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress'],


// web server port
port: 9876,


// enable / disable colors in the output (reporters and logs)
colors: true,


// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,


// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,


// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: ['Chrome'],


// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: true,

// Concurrency level
// how many browser should be started simultaneous
concurrency: Infinity
});
};
22 changes: 22 additions & 0 deletions dan-stineback/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"name": "ng-adventure",
"version": "1.0.0",
"description": "ng boilerplate",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"angular": "^1.5.7",
"angular-mocks": "^1.5.7",
"del": "^2.2.1",
"gulp": "^3.9.1",
"jasmine-core": "^2.4.1",
"karma": "^1.1.0",
"karma-chrome-launcher": "^1.0.1",
"webpack-stream": "^3.2.0"
},
"dependencies": {}
}
7 changes: 7 additions & 0 deletions dan-stineback/server.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
'use strict';
var express = require('express');
var app = express();
app.use(express.static(__dirname + '/build'));
var server = app.listen(3003, function(){
console.log('server is running at %s', server.address().port);
});
23 changes: 23 additions & 0 deletions dan-stineback/test/error_services_test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
'use strict';
const angular = require('angular');
require('angular-mocks');
require('../app/js/client');

describe('error service tests', function() {
let errorService;
beforeEach(() => {
angular.mock.module('FirstApp');
angular.mock.inject(function(ErrorService){
errorService = ErrorService;
});
});
it('should have test getErrors', () => {
expect(typeof errorService.getErrors).toBe('function');
});
it('should test logErorr', () => {
expect(typeof errorService.logErorr).toBe('function');
});
it('should test errors', () => {
expect(Array.isArray(errorService.getErrors())).toBe(true);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would be good to test logging an error and retrieving result, like
errorService.logError('test error')({});
let errorArray = errorService.getErrors();
expect(errorArray[0]).toBe('test error');

});
});
Loading