Sha256: 3960bf6c9e59f3b940fc394c0971042988d9e942dcb239aac0cc52ea6df579d8

Contents?: true

Size: 1.67 KB

Versions: 185

Compression:

Stored size: 1.67 KB

Contents

import Crypto from './crypto-square';

describe('Crypto', () => {
  test('normalize strange characters', () => {
    const crypto = new Crypto('s#$%^&plunk');
    expect(crypto.normalizePlaintext()).toEqual('splunk');
  });

  xtest('normalize numbers', () => {
    const crypto = new Crypto('1, 2, 3 GO!');
    expect(crypto.normalizePlaintext()).toEqual('123go');
  });

  xtest('size of small square', () => {
    const crypto = new Crypto('1234');
    expect(crypto.size()).toEqual(2);
  });

  xtest('size of small square with additional non-number chars', () => {
    const crypto = new Crypto('1 2 3 4');
    expect(crypto.size()).toEqual(2);
  });

  xtest('size of slightly larger square', () => {
    const crypto = new Crypto('123456789');
    expect(crypto.size()).toEqual(3);
  });

  xtest('size of non-perfect square', () => {
    const crypto = new Crypto('123456789abc');
    expect(crypto.size()).toEqual(4);
  });

  xtest('plain text segments', () => {
    const crypto = new Crypto('Never vex thine heart with idle woes');
    expect(crypto.plaintextSegments()).toEqual(['neverv', 'exthin', 'eheart', 'withid', 'lewoes']);
  });

  xtest('plain text segments', () => {
    const crypto = new Crypto('ZOMG! ZOMBIES!!!');
    expect(crypto.plaintextSegments()).toEqual(['zomg', 'zomb', 'ies']);
  });

  xtest('cipher text', () => {
    const crypto = new Crypto('Time is an illusion. Lunchtime doubly so.');
    expect(crypto.ciphertext()).toEqual('tasneyinicdsmiohooelntuillibsuuml');
  });

  xtest('cipher text', () => {
    const crypto = new Crypto('We all know interspecies romance is weird.');
    expect(crypto.ciphertext()).toEqual('wneiaweoreneawssciliprerlneoidktcms');
  });
});

Version data entries

185 entries across 185 versions & 1 rubygems

Version Path
trackler-2.2.1.159 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.158 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.157 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.156 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.155 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.154 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.153 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.152 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.151 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.150 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.149 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.148 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.147 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.146 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.145 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.144 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.143 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.142 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.141 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js
trackler-2.2.1.140 tracks/ecmascript/exercises/crypto-square/crypto-square.spec.js