I'm unable to figure out how to write a Jasmine test in TypeScript when the class to be tested is inside a module definition. This setup works fine:
Calculator.ts:
export class Calculator {
add(x: number, y: number): number {
return x + y;
}
}
CalculatorTest.ts:
///<reference path="scripts/typings/jasmine/jasmine.d.ts"/>
///<reference path="../NancyApplication506/app/Calculator.ts"/>
import Calculator = require("../NancyApplication506/app/Calculator");
describe("Calculator tests", () => {
var calculator: Calculator.Calculator;
beforeEach(() => {
calculator = new Calculator.Calculator();
});
it("should be able to add", () => {
expect(calculator.add(21,21)).toBe(42);
});
});
When I change Calculator.ts like this, however, I have been unable to figure out how to write my test.
module SomeModuleName {
export class Calculator {
add(x: number, y: number): number {
return x + y;
}
}
}
I have tried dozens of different things, all resulting in complete failure. Please please please help!