Skip to content

Instantly share code, notes, and snippets.

View samueleresca's full-sized avatar

Samuele Resca samueleresca

View GitHub Profile
<html>
<head>
<title>Test</title>
</head>
<body>
<!--Body content-->
</body>
<script type="text/javascript" src="Scripts/compiled/main.js"></script>
</html>
class Telefilm {
title : string;
description: string;
characters: Character[];
constructor( title: string, description: string, characters: Character[]) {
this.title= title;
this.description= description;
this.characters= characters;
}
/// <reference path="Ticket.ts"/>
class Vehicle {
private _brand: string;
private _height: number;
private _weight: number;
private _license_plate: string;
private _isParked: boolean;
/// <reference path="Vehicle.ts"/>
class Car extends Vehicle {
private _car_insurance: string;
private _license_plate: string;
constructor(brand: string, height: number, weight: number, car_insurance: string, license_plate: string) {
super(brand, height, weight);
this._car_insurance = car_insurance;
class Ticket {
private _id: string;
private _enterDate: Date;
private _exitDate: Date;
constructor(parking_lot: string) {
this._id = parking_lot + "-" + ((new Date()).getTime().toString());
this._enterDate = new Date(); //GET CURRENT DATE
this._exitDate = null;
}
/// <reference path="..\Vehicle.ts"/>
/// <reference path="Utils.ts"/>
/*
*Interface ParkingLot
*/
interface ParkingLot<V, T> {
parkVehicle(vehicle: V): T;
exitVehicle(ticket: T): V;
}
{
"name": "blog-tdd-using-mocha",
"version": "0.1.0",
"contributors": [
{
"name": "Samuele Resca"
}
],
"devDependencies": {
"chai": "^1.10.0",
/*
*SIMPLE CLASS: describes telefilms
*/
var Telefilm = function (name, characters) {
this.name = name;
this.characters = characters;
};
Telefilm.prototype.getName = function () {
//FIX to the error : "expect is not defined"
var expect = chai.expect;
//describe Telefilm tests
describe('Telefilm', function() {
//Before the execution, initialize the object
before(function() {
this.telefilm = new Telefilm("Scrubs", ["John Dorian"]);
});
<meta charset="utf-8">
<link rel="stylesheet" href="../node_modules/grunt-blanket-mocha/node_modules/mocha/mocha.css">
<div id="mocha"><!--CONTENT OF TEST RESULTS --></div>
<div id="test" style="position: fixed; top: 0; left: -99999px;">
</div>
<!-- Testing dependencies -->
<script src="../node_modules/chai/chai.js"></script>
<script src="../node_modules/sinon-chai/lib/sinon-chai.js"></script>
<script src="../node_modules/sinon/pkg/sinon.js"></script>