1
exercism fetch coffeescript nucleotide-count

nucleotide-count_test.spec.coffee

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
DNA = require './example'

describe 'DNA', ->
  it 'has no nucleotides', ->
    expected =
      A: 0
      T: 0
      C: 0
      G: 0
    dna = new DNA('')
    expect(dna.nucleotideCounts).toEqual expected

  xit 'has no adoenosine', ->
    dna = new DNA('')
    expect(dna.count('A')).toEqual 0

  xit 'repetitive cytidine gets counts', ->
    dna = new DNA('CCCCC')
    expect(dna.count('C')).toEqual 5

  xit 'repetitive sequence has only gaunosine', ->
    dna = new DNA('GGGGGGGG')
    expected =
      A: 0
      T: 0
      C: 0
      G: 8
    expect(dna.nucleotideCounts).toEqual expected

  xit 'counts only thymidine', ->
    dna = new DNA('GGGGTAACCCGG')
    expect(dna.count('T')).toEqual 1

  xit 'counts a nucleotide only once', ->
    dna = new DNA('GGTTGG')
    dna.count('T')
    expect(dna.count('T')).toEqual 2

  xit 'validates nucleotides', ->
    dna = new DNA('GGTTGG')
    expect ->
      dna.count 'X'
    .toThrow new Error('Invalid Nucleotide')

  xit 'counts all nucleotides', ->
    dna = new DNA('AGCTTTTCATTCTGACTGCAACGGGCAATATGTCTCTGTGTGGATTAAAAAAAGAGTGTCTGATAGCAGC')
    expected =
      A: 20
      T: 21
      G: 17
      C: 12
    expect(dna.nucleotideCounts).toEqual expected