|
| 1 | +import AtbashCipher from './atbash-cipher' |
| 2 | + |
| 3 | +describe('AtbashCipher', () => { |
| 4 | + let atbash: AtbashCipher |
| 5 | + |
| 6 | + beforeAll(() => { |
| 7 | + atbash = new AtbashCipher() |
| 8 | + }) |
| 9 | + |
| 10 | + describe("encoding", () => { |
| 11 | + it("encode yes", () => { |
| 12 | + const cipherText = atbash.encode("yes") |
| 13 | + expect(cipherText).toEqual("bvh") |
| 14 | + }) |
| 15 | + |
| 16 | + xit("encode no", () => { |
| 17 | + const cipherText = atbash.encode("no") |
| 18 | + expect(cipherText).toEqual("ml") |
| 19 | + }) |
| 20 | + |
| 21 | + xit("encode OMG", () => { |
| 22 | + const cipherText = atbash.encode("OMG") |
| 23 | + expect(cipherText).toEqual("lnt") |
| 24 | + }) |
| 25 | + |
| 26 | + xit("encode spaces", () => { |
| 27 | + const cipherText = atbash.encode("O M G") |
| 28 | + expect(cipherText).toEqual("lnt") |
| 29 | + }) |
| 30 | + |
| 31 | + xit("encode mindblowingly", () => { |
| 32 | + const cipherText = atbash.encode("mindblowingly") |
| 33 | + expect(cipherText).toEqual("nrmwy oldrm tob") |
| 34 | + }) |
| 35 | + |
| 36 | + xit("encode numbers", () => { |
| 37 | + const cipherText = atbash.encode("Testing,1 2 3, testing.") |
| 38 | + expect(cipherText).toEqual("gvhgr mt123 gvhgr mt") |
| 39 | + }) |
| 40 | + |
| 41 | + xit("encode deep thought", () => { |
| 42 | + const cipherText = atbash.encode("Truth is fiction.") |
| 43 | + expect(cipherText).toEqual("gifgs rhurx grlm") |
| 44 | + }) |
| 45 | + |
| 46 | + xit("encode all the letters", () => { |
| 47 | + const cipherText = atbash.encode("thequickbrownfoxjumpsoverthelazydog") |
| 48 | + expect(cipherText).toEqual("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt") |
| 49 | + }) |
| 50 | + }) |
| 51 | + |
| 52 | + xdescribe("decode", () => { |
| 53 | + xit("decode exercism", () => { |
| 54 | + const plainText = atbash.decode("vcvix rhn") |
| 55 | + expect(plainText).toEqual("exercism") |
| 56 | + }) |
| 57 | + |
| 58 | + xit("decode a sentence", () => { |
| 59 | + const cipherText = atbash.decode("zmlyh gzxov rhlug vmzhg vkkrm thglm v") |
| 60 | + expect(cipherText).toEqual("anobstacleisoftenasteppingstone") |
| 61 | + }) |
| 62 | + |
| 63 | + xit("decode numbers", () => { |
| 64 | + const plainText = atbash.decode("gvhgr mt123 gvhgr mt") |
| 65 | + expect(plainText).toEqual("testing123testing") |
| 66 | + }) |
| 67 | + |
| 68 | + xit("decode all the letters", () => { |
| 69 | + const cipherText = atbash.decode("gsvjf rxpyi ldmul cqfnk hlevi gsvoz abwlt") |
| 70 | + expect(cipherText).toEqual("thequickbrownfoxjumpsoverthelazydog") |
| 71 | + }) |
| 72 | + }) |
| 73 | +}) |
0 commit comments