2017-12-15 10:56:14 -08:00
|
|
|
const caesar = require("./caesar");
|
2017-08-25 11:59:26 -07:00
|
|
|
|
2017-12-15 10:56:14 -08:00
|
|
|
describe("caesar", () => {
|
|
|
|
it("works with single letters", () => {
|
|
|
|
expect(caesar("A", 1)).toEqual("B");
|
2017-08-25 11:59:26 -07:00
|
|
|
});
|
2017-12-15 10:56:14 -08:00
|
|
|
it("works with words", () => {
|
|
|
|
expect(caesar("Aaa", 1)).toEqual("Bbb");
|
2017-08-25 11:59:26 -07:00
|
|
|
});
|
2017-12-15 10:56:14 -08:00
|
|
|
it("works with phrases", () => {
|
|
|
|
expect(caesar("Hello, World!", 5)).toEqual("Mjqqt, Btwqi!");
|
2017-08-25 11:59:26 -07:00
|
|
|
});
|
2017-12-15 10:56:14 -08:00
|
|
|
it("works with negative shift", () => {
|
|
|
|
expect(caesar("Mjqqt, Btwqi!", -5)).toEqual("Hello, World!");
|
2017-08-25 11:59:26 -07:00
|
|
|
});
|
2017-12-15 10:56:14 -08:00
|
|
|
it("wraps", () => {
|
|
|
|
expect(caesar("Z", 1)).toEqual("A");
|
2017-08-25 11:59:26 -07:00
|
|
|
});
|
2017-12-15 10:56:14 -08:00
|
|
|
it("works with large shift factors", () => {
|
|
|
|
expect(caesar("Hello, World!", 75)).toEqual("Ebiil, Tloia!");
|
2017-08-25 11:59:26 -07:00
|
|
|
});
|
|
|
|
});
|