Sha256: e2edb8be12196b6a6bc5f7c68678156eee28a2d570a9a603ff48ea250eeee380

Contents?: true

Size: 1.69 KB

Versions: 68

Compression:

Stored size: 1.69 KB

Contents

var RotationalCipher = require('./rotational-cipher');

describe('RotationalCipher', function () {
  var rotationalCipher = new RotationalCipher();

  it('rotate a by 0, same output as input', function () {
    var expected = 'a';
    expect(rotationalCipher.rotate('a', 0)).toEqual(expected);
  });

  xit('rotate a by 1', function () {
    var expected = 'b';
    expect(rotationalCipher.rotate('a', 1)).toEqual(expected);
  });

  xit('rotate a by 26, same output as input', function () {
    var expected = 'a';
    expect(rotationalCipher.rotate('a', 26)).toEqual(expected);
  });

  xit('rotate m by 13', function () {
    var expected = 'z';
    expect(rotationalCipher.rotate('m', 13)).toEqual(expected);
  });

  xit('rotate n by 13 with wrap around alphabet', function () {
    var expected = 'a';
    expect(rotationalCipher.rotate('n', 13)).toEqual(expected);
  });

  xit('rotate capital letters', function () {
    var expected = 'TRL';
    expect(rotationalCipher.rotate('OMG', 5)).toEqual(expected);
  });

  xit('rotate spaces', function () {
    var expected = 'T R L';
    expect(rotationalCipher.rotate('O M G', 5)).toEqual(expected);
  });

  xit('rotate numbers', function () {
    var expected = 'Xiwxmrk 1 2 3 xiwxmrk';
    expect(rotationalCipher.rotate('Testing 1 2 3 testing', 4)).toEqual(expected);
  });

  xit('rotate punctuation', function () {
    var expected = 'Gzo\'n zvo, Bmviyhv!';
    expect(rotationalCipher.rotate('Let\'s eat, Grandma!', 21)).toEqual(expected);
  });

  xit('rotate all letters', function () {
    var expected = 'Gur dhvpx oebja sbk whzcf bire gur ynml qbt.';
    expect(rotationalCipher.rotate('The quick brown fox jumps over the lazy dog.', 13)).toEqual(expected);
  });
});

Version data entries

68 entries across 68 versions & 1 rubygems

Version Path
trackler-2.2.1.139 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.138 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.137 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.136 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.135 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.134 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.133 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.132 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.131 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.130 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.129 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.128 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.127 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.126 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.125 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.124 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.123 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.122 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.121 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.120 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js