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.180 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.179 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.178 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.177 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.176 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.175 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.174 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.173 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.172 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.171 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.170 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.169 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.167 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.166 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.165 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.164 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.163 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.162 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.161 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js
trackler-2.2.1.160 tracks/javascript/exercises/rotational-cipher/rotational-cipher.spec.js