odin-javascript-exercises/13_caesar/solution/caesar-solution.spec.js

24 lines
728 B
JavaScript
Raw Normal View History

2023-01-21 09:53:41 -08:00
const caesar = require("./caesar");
2022-02-20 11:07:44 -08:00
2023-01-21 09:53:41 -08:00
test("works with single letters", () => {
expect(caesar("A", 1)).toBe("B");
2022-02-20 11:07:44 -08:00
});
2023-01-21 09:53:41 -08:00
test.skip("works with words", () => {
expect(caesar("Aaa", 1)).toBe("Bbb");
2022-02-20 11:07:44 -08:00
});
2023-01-21 09:53:41 -08:00
test.skip("works with phrases", () => {
expect(caesar("Hello, World!", 5)).toBe("Mjqqt, Btwqi!");
2022-02-20 11:07:44 -08:00
});
2023-01-21 09:53:41 -08:00
test.skip("works with negative shift", () => {
expect(caesar("Mjqqt, Btwqi!", -5)).toBe("Hello, World!");
2022-02-20 11:07:44 -08:00
});
2023-01-21 09:53:41 -08:00
test.skip("wraps", () => {
expect(caesar("Z", 1)).toBe("A");
2022-02-20 11:07:44 -08:00
});
2023-01-21 09:53:41 -08:00
test.skip("works with large shift factors", () => {
expect(caesar("Hello, World!", 75)).toBe("Ebiil, Tloia!");
2022-02-20 11:07:44 -08:00
});
2023-01-21 09:53:41 -08:00
test.skip("works with large negative shift factors", () => {
expect(caesar("Hello, World!", -29)).toBe("Ebiil, Tloia!");
2022-02-20 11:07:44 -08:00
});