Sha256: f90c8493480ca00b36a6faac7eabecf004d714823e94a55acaefcc9194c4f390

Contents?: true

Size: 1.79 KB

Versions: 123

Compression:

Stored size: 1.79 KB

Contents

import translate from './protein-translation';

describe('ProteinTranslation', () => {
  test('Empty RNA has no proteins', () => {
    expect(translate()).toEqual([]);
  });

  xtest('Methionine codon translates into protein', () => {
    expect(translate('AUG')).toEqual(['Methionine']);
  });

  xtest('Phenylalanine codons translate into protein', () => {
    expect(translate('UUUUUC')).toEqual(['Phenylalanine', 'Phenylalanine']);
  });

  xtest('Leucine codons translate into protein', () => {
    expect(translate('UUAUUG')).toEqual(['Leucine', 'Leucine']);
  });

  xtest('Serine codons translate into protein', () => {
    expect(translate('UCUUCCUCAUCG')).toEqual(['Serine', 'Serine', 'Serine', 'Serine']);
  });

  xtest('Tyrosine codons translate into protein', () => {
    expect(translate('UAUUAC')).toEqual(['Tyrosine', 'Tyrosine']);
  });

  xtest('Cysteine codons translate into protein', () => {
    expect(translate('UGUUGC')).toEqual(['Cysteine', 'Cysteine']);
  });

  xtest('Tryptophan codon translates into protein', () => {
    expect(translate('UGG')).toEqual(['Tryptophan']);
  });

  xtest('Sequence starts with stop codon 1', () => {
    expect(translate('UAAUUUUUA')).toEqual([]);
  });

  xtest('Sequence starts with stop codon 2', () => {
    expect(translate('UAGAUGUAU')).toEqual([]);
  });

  xtest('Sequence starts with stop codon 3', () => {
    expect(translate('UGAUGU')).toEqual([]);
  });

  xtest('Small RNA strand', () => {
    expect(translate('AUGUUUUCU')).toEqual(['Methionine', 'Phenylalanine', 'Serine']);
  });

  xtest('Stop codon ends translation', () => {
    expect(translate('AUGUUUUCUUAAAUG')).toEqual(['Methionine', 'Phenylalanine', 'Serine']);
  });

  xtest('Invalid codon throws error', () => {
    expect(() => translate('LOL')).toThrow(new Error('Invalid codon'));
  });
});

Version data entries

123 entries across 123 versions & 1 rubygems

Version Path
trackler-2.2.1.180 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.179 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.178 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.177 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.176 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.175 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.174 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.173 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.172 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.171 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.170 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.169 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.167 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.166 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.165 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.164 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.163 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.162 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.161 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.160 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js