Commit e359d321 authored by Mark Stenglein's avatar Mark Stenglein

Implement Test Driven Development!!!!!

- thats right, just got it set up so I can write the tests _first_

- Even better, both the code and the tests are in typescript!
parent 3b453cb7
......@@ -2,9 +2,11 @@ import ContentLine from "./ContentLine";
import { expect } from "chai";
import "mocha";
describe("Hello", () => {
it("Should say hi", () => {
expect("hi").to.equal("hi");
});
});
describe("ContentLine", () => {
it("Should exist", () => {
let result = !ContentLine;
expect(result).to.be.false;
})
})
export function sayHello(name: string) {
return `Hello from ${name}`;
}
import { sayHello } from "./greet";
console.log(sayHello("TypeScript"));
import { isAlpha } from "./util";
import { expect } from "chai";
import "mocha";
describe("util", () => {
describe("isAlpha", () => {
it("Should return false for numbers", () => {
let test = "12345";
let result = isAlpha(test);
expect(result).to.be.false;
});
it("Should return false for alpha numerics", () => {
let test = "a2a";
let result = isAlpha(test);
expect(result).to.be.false;
});
it("Should return true for lowercase alpha", () => {
let test = "abcdef";
let result = isAlpha(test);
expect(result).to.be.true;
});
it("Should return true for uppercase alpha", () => {
let test = "ABCDEF";
let result = isAlpha(test);
expect(result).to.be.true
});
it("Should return true for mixed alpha", () => {
let test = "aBcDeF";
let result = isAlpha(test);
expect(result).to.be.true;
});
});
});
export function isAlpha(input: string): boolean {
return /^[a-zA-Z]+$/.test(input);
}
\ No newline at end of file
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment