Skip to content

Commit

Permalink
Adding basic unit tests to project.
Browse files Browse the repository at this point in the history
  • Loading branch information
ilanvolow committed May 3, 2020
1 parent 0afe919 commit 9a70305
Show file tree
Hide file tree
Showing 19 changed files with 3,741 additions and 234 deletions.
3 changes: 3 additions & 0 deletions __testfixtures__/function-anonymous.input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let testLog = function() {

}
3 changes: 3 additions & 0 deletions __testfixtures__/function-anonymous.output.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let testLog = function() {
console.log("[logitall] __testfixtures__/function-anonymous.input.ts:1:function()");
}
3 changes: 3 additions & 0 deletions __testfixtures__/function-arrow.input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let testLog = () => {

};
3 changes: 3 additions & 0 deletions __testfixtures__/function-arrow.output.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
let testLog = () => {
console.log("[logitall] __testfixtures__/function-arrow.input.ts:1:() => {}");
};
3 changes: 3 additions & 0 deletions __testfixtures__/function-declaration.input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function testLog() {

}
3 changes: 3 additions & 0 deletions __testfixtures__/function-declaration.output.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function testLog() {
console.log("[logitall] __testfixtures__/function-declaration.input.ts:1:testLog()");
}
3 changes: 3 additions & 0 deletions __testfixtures__/function-return.input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function bunny() {
return 'bubba';
}
5 changes: 5 additions & 0 deletions __testfixtures__/function-return.output.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
function bunny() {
console.log("[logitall] __testfixtures__/function-return.input.ts:1:bunny()");
console.log("[logitall] __testfixtures__/function-return.input.ts:2");
return 'bubba';
}
22 changes: 22 additions & 0 deletions __testfixtures__/method-constructor.input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class BaseClass {

public stuff:string;

constructor() {
this.stuff = "things"
}

doStuff() {
let matter = this.stuff;
}
}

class Subclass extends BaseClass {
items:string[];

constructor() {
super();
this.items = ["ThingOne", "ThingTwo"];
}
}

32 changes: 32 additions & 0 deletions __testfixtures__/method-constructor.output.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
class BaseClass {

public stuff:string;

constructor() {
console.log("[logitall] __testfixtures__/method-constructor.input.ts:5:constructor()");
console.log("[logitall] __testfixtures__/method-constructor.input.ts:6");
this.stuff = "things"
}

doStuff() {
console.log("[logitall] __testfixtures__/method-constructor.input.ts:9:doStuff()");
let matter = this.stuff;
}
}

class Subclass extends BaseClass {
items:string[];

constructor() {
super();

console.log(
"[logitall] __testfixtures__/method-constructor.input.ts:17:constructor()"
);

console.log("[logitall] __testfixtures__/method-constructor.input.ts:19");
this.items = ["ThingOne", "ThingTwo"];
}
}


5 changes: 5 additions & 0 deletions __testfixtures__/method-instance.input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class TestInstanceMethodClass {
testlog() {
let bunny = 'bubba';
}
}
6 changes: 6 additions & 0 deletions __testfixtures__/method-instance.output.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class TestInstanceMethodClass {
testlog() {
console.log("[logitall] __testfixtures__/method-instance.input.ts:2:testlog()");
let bunny = 'bubba';
}
}
6 changes: 6 additions & 0 deletions __testfixtures__/method-static.input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
class TestStaticMethodClass {

static calculateArea(radius:number) {
return this.pi * radius * radius;
}
}
8 changes: 8 additions & 0 deletions __testfixtures__/method-static.output.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
class TestStaticMethodClass {

static calculateArea(radius:number) {
console.log("[logitall] __testfixtures__/method-static.input.ts:3:calculateArea()");
console.log("[logitall] __testfixtures__/method-static.input.ts:4");
return this.pi * radius * radius;
}
}
3 changes: 3 additions & 0 deletions __testfixtures__/statement-expression.input.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
function bunny() {
let response = bubba();
}
4 changes: 4 additions & 0 deletions __testfixtures__/statement-expression.output.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
function bunny() {
console.log("[logitall] __testfixtures__/statement-expression.input.ts:1:bunny()");
let response = bubba();
}
11 changes: 11 additions & 0 deletions __tests__/transform-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
jest.autoMockOff();
const defineTest = require('jscodeshift/dist/testUtils').defineTest;

defineTest(__dirname + "../", 'transform', {'relpath': '__testfixtures__'}, 'function-anonymous', { 'parser': 'ts' });
defineTest(__dirname + "../", 'transform', {'relpath': '__testfixtures__'}, 'function-arrow', { 'parser': 'ts' });
defineTest(__dirname + "../", 'transform', {'relpath': '__testfixtures__'}, 'function-declaration', { 'parser': 'ts' });
defineTest(__dirname + "../", 'transform', {'relpath': '__testfixtures__'}, 'function-return', { 'parser': 'ts' });
defineTest(__dirname + "../", 'transform', {'relpath': '__testfixtures__'}, 'method-constructor', { 'parser': 'ts' });
defineTest(__dirname + "../", 'transform', {'relpath': '__testfixtures__'}, 'method-instance', { 'parser': 'ts' });
defineTest(__dirname + "../", 'transform', {'relpath': '__testfixtures__'}, 'method-static', { 'parser': 'ts' });
defineTest(__dirname + "../", 'transform', {'relpath': '__testfixtures__'}, 'statement-expression', { 'parser': 'ts' });
Loading

0 comments on commit 9a70305

Please sign in to comment.