-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Yosuke Furukawa
committed
Dec 15, 2014
1 parent
6c26f94
commit ef7bc7a
Showing
3 changed files
with
39 additions
and
1 deletion.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/* no transpile, this is */ | ||
(function(global){ | ||
"use strict"; | ||
var Person = function(name, age){ | ||
this.name = name; | ||
this.age = age; | ||
}; | ||
Person.prototype.getAge = function() { | ||
return this.age; | ||
}; | ||
Person.prototype.greet = function() { | ||
return "Hello! I am " + this.name + ". My age is " + this.age; | ||
} | ||
if (module && module.exports) { | ||
module.exports = Person; | ||
} else { | ||
global.Person = Person; | ||
} | ||
}(typeof global !== 'undefined' ? global : this)); | ||
|
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
let assert = require("power-assert") | ||
let Person = require("../demo/person") | ||
|
||
describe("Person", ()=>{ | ||
let name = "Alice" | ||
let age = 4 | ||
let alice = new Person(name, age) | ||
it("alice get age", ()=>{ | ||
assert.equal(alice.getAge(), age) | ||
}) | ||
it("alice greet", ()=>{ | ||
assert.equal(alice.greet(), `Hello! I am ${name}. My age is ${age}`) | ||
}) | ||
}) | ||
|