This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class Task { | |
public name: string; | |
public active: boolean; | |
public render() : string { | |
if (this.active) { | |
return '[Inactive] ' + this.name; | |
} | |
return this.name; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tsc --module commonjs task.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tsc --module amd task.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface IDataDriver { | |
getConnection() : Promise; | |
getRepository(repositoryName : string) : Promise; | |
getIdType(value : any) : any; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class MongoDataDriver implements IDataDriver { | |
getConnection() : Promise { | |
return new Promise((resolve, reject) => { | |
Mongo.MongoClient.connect(this.config.connectionURL, (err, connection) => { | |
if (err) { | |
reject(err); | |
} | |
resolve(connection); | |
}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var router = Express.Router(); | |
var taskManager = new DataManager( | |
new MongoDataDriver(EnvDataConfig.getInstance()), | |
Task | |
); | |
var taskController = new ExpressController(); | |
taskController.manager = taskManager; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tsc --target es6 task.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tsc --module amd task.ts |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var mocha = require('gulp-mocha'); | |
gulp.task('test:api', ['compile:api'], function() { | |
return gulp.src('api/unit/test/location/**/*.js', { | |
read: false | |
}).pipe(mocha({ | |
reporter: 'spec' | |
})); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = function(config) { | |
config.set({ | |
basePath: '', | |
frameworks: ['mocha', 'requirejs', 'chai-sinon'], | |
// Here, we specify which files Karma should load into the test harness. | |
files: [ | |
// First, load an additional test runner that the karma-requirejs plugin will need. | |
'src/test/karma-test-runner.js', |