Skip to content

Commit

Permalink
Updated with nodejs console example and fix for nodejs applications.
Browse files Browse the repository at this point in the history
  • Loading branch information
Steve-Fenton committed Nov 22, 2014
1 parent c60a9dc commit 4cf8991
Show file tree
Hide file tree
Showing 33 changed files with 3,214 additions and 40 deletions.
10 changes: 3 additions & 7 deletions tsUnit.Examples/Scripts/tsUnit/tsUnit.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
interface Object {
[index: string]: any;
}

module tsUnit {
export class Test {
private tests: TestDefintion[] = [];
Expand Down Expand Up @@ -37,21 +33,21 @@ module tsUnit {
var dynamicTestClass = <any>testClass;
var testsGroupName = this.tests[i].name;

if (!testRunLimiter.isTestsGroupActive(testsGroupName)) {
if (testRunLimiter && !testRunLimiter.isTestsGroupActive(testsGroupName)) {
continue;
}

for (var unitTestName in testClass) {
if (this.isReservedFunctionName(unitTestName)
|| (typeof dynamicTestClass[unitTestName] !== 'function')
|| !testRunLimiter.isTestActive(unitTestName)) {
|| (testRunLimiter && !testRunLimiter.isTestActive(unitTestName))) {
continue;
}

if (typeof dynamicTestClass[unitTestName].parameters !== 'undefined') {
parameters = dynamicTestClass[unitTestName].parameters;
for (var parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) {
if (!testRunLimiter.isParametersSetActive(parameterIndex)) {
if (testRunLimiter && !testRunLimiter.isParametersSetActive(parameterIndex)) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion tsUnit.Examples/packages.config
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="tsUnit" version="1.6.0" targetFramework="net45" />
<package id="tsUnit" version="1.7.0" targetFramework="net45" />
</packages>
10 changes: 3 additions & 7 deletions tsUnit.External.Examples/Scripts/tsUnit/tsUnit.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
interface Object {
[index: string]: any;
}

module tsUnit {
export class Test {
private tests: TestDefintion[] = [];
Expand Down Expand Up @@ -37,21 +33,21 @@ module tsUnit {
var dynamicTestClass = <any>testClass;
var testsGroupName = this.tests[i].name;

if (!testRunLimiter.isTestsGroupActive(testsGroupName)) {
if (testRunLimiter && !testRunLimiter.isTestsGroupActive(testsGroupName)) {
continue;
}

for (var unitTestName in testClass) {
if (this.isReservedFunctionName(unitTestName)
|| (typeof dynamicTestClass[unitTestName] !== 'function')
|| !testRunLimiter.isTestActive(unitTestName)) {
|| (testRunLimiter && !testRunLimiter.isTestActive(unitTestName))) {
continue;
}

if (typeof dynamicTestClass[unitTestName].parameters !== 'undefined') {
parameters = dynamicTestClass[unitTestName].parameters;
for (var parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) {
if (!testRunLimiter.isParametersSetActive(parameterIndex)) {
if (testRunLimiter && !testRunLimiter.isParametersSetActive(parameterIndex)) {
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion tsUnit.External.Examples/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="RequireJS" version="2.1.15" targetFramework="net45" />
<package id="tsUnit.external" version="1.6.0" targetFramework="net45" />
<package id="tsUnit.external" version="1.7.0" targetFramework="net45" />
</packages>
2 changes: 1 addition & 1 deletion tsUnit.External.Packager/Package.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package >
<metadata>
<id>tsUnit.external</id>
<version>1.6.0</version>
<version>1.7.0</version>
<title>tsUnit.external</title>
<authors>Steve Fenton</authors>
<owners>Steve Fenton</owners>
Expand Down
10 changes: 3 additions & 7 deletions tsUnit.External.Packager/content/Scripts/tsUnit/tsUnit.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
interface Object {
[index: string]: any;
}

module tsUnit {
export class Test {
private tests: TestDefintion[] = [];
Expand Down Expand Up @@ -37,21 +33,21 @@ module tsUnit {
var dynamicTestClass = <any>testClass;
var testsGroupName = this.tests[i].name;

if (!testRunLimiter.isTestsGroupActive(testsGroupName)) {
if (testRunLimiter && !testRunLimiter.isTestsGroupActive(testsGroupName)) {
continue;
}

for (var unitTestName in testClass) {
if (this.isReservedFunctionName(unitTestName)
|| (typeof dynamicTestClass[unitTestName] !== 'function')
|| !testRunLimiter.isTestActive(unitTestName)) {
|| (testRunLimiter && !testRunLimiter.isTestActive(unitTestName))) {
continue;
}

if (typeof dynamicTestClass[unitTestName].parameters !== 'undefined') {
parameters = dynamicTestClass[unitTestName].parameters;
for (var parameterIndex = 0; parameterIndex < parameters.length; parameterIndex++) {
if (!testRunLimiter.isParametersSetActive(parameterIndex)) {
if (testRunLimiter && !testRunLimiter.isParametersSetActive(parameterIndex)) {
continue;
}

Expand Down
21 changes: 21 additions & 0 deletions tsUnit.Node.Examples/Scripts/FizzBuzz.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tsUnit.Node.Examples/Scripts/FizzBuzz.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions tsUnit.Node.Examples/Scripts/FizzBuzz.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
class FizzBuzz {
generate(input: number): any {
var output = '';

if (input % 3 === 0) {
output += 'Fizz';
}

if (input % 5 === 0) {
output += 'Buzz';
}

return output === '' ? input : output;
}
}

export = FizzBuzz;
42 changes: 42 additions & 0 deletions tsUnit.Node.Examples/Scripts/FizzBuzzTests.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions tsUnit.Node.Examples/Scripts/FizzBuzzTests.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 30 additions & 0 deletions tsUnit.Node.Examples/Scripts/FizzBuzzTests.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import tsUnit = require('./tsUnit/tsUnit');
import FizzBuzz = require('./FizzBuzz');

var target = new FizzBuzz();

export class FizzBuzzTests extends tsUnit.TestClass {

normalNumbersReturnOriginalNumber() {
this.areIdentical(1, target.generate(1));
this.areIdentical(2, target.generate(2));
this.areIdentical(4, target.generate(4));
}

numberDivisibleByThreeShouldReturnFizz() {
this.areIdentical("Fizz", target.generate(3));
this.areIdentical("Fizz", target.generate(6));
this.areIdentical("Fizz", target.generate(9));
}

numbersDivisibleByFiveShouldReturnBuzz() {
this.areIdentical("Buzz", target.generate(5));
this.areIdentical("Buzz", target.generate(10));
this.areIdentical("Buzz", target.generate(20));
}
numbersDivisibleByThreeAndFiveShouldReturnFizzBuzz() {
this.areIdentical("FizzBuzz", target.generate(15));
this.areIdentical("FizzBuzz", target.generate(30));
this.areIdentical("FizzBuzz", target.generate(45));
}
}
Loading

0 comments on commit 4cf8991

Please sign in to comment.