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.78 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.77 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.76 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.75 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.74 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.73 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.72 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.71 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.70 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.69 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.68 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.67 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.66 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.65 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.64 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.63 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.62 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.61 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.60 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js
trackler-2.2.1.59 tracks/ecmascript/exercises/protein-translation/protein-translation.spec.js