odin-javascript-exercises/caesar/caesar.spec.js
2017-12-15 12:56:14 -06:00

22 lines
649 B
JavaScript

const caesar = require("./caesar");
describe("caesar", () => {
it("works with single letters", () => {
expect(caesar("A", 1)).toEqual("B");
});
it("works with words", () => {
expect(caesar("Aaa", 1)).toEqual("Bbb");
});
it("works with phrases", () => {
expect(caesar("Hello, World!", 5)).toEqual("Mjqqt, Btwqi!");
});
it("works with negative shift", () => {
expect(caesar("Mjqqt, Btwqi!", -5)).toEqual("Hello, World!");
});
it("wraps", () => {
expect(caesar("Z", 1)).toEqual("A");
});
it("works with large shift factors", () => {
expect(caesar("Hello, World!", 75)).toEqual("Ebiil, Tloia!");
});
});