1
exercism fetch javascript kindergarten-garden

kindergarten-garden.spec.js

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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
var Garden = require('./kindergarten-garden');

describe('Garden', function () {
  it('for Alice', function () {
    expect(new Garden('RC\nGG').alice)
      .toEqual(['radishes', 'clover', 'grass', 'grass']);
  });

  xit('another for Alice', function () {
    expect(new Garden('VC\nRC').alice)
      .toEqual(['violets', 'clover', 'radishes', 'clover']);
  });

  xit('for Bob', function () {
    expect(new Garden('VVCG\nVVRC').bob)
      .toEqual(['clover', 'grass', 'radishes', 'clover']);
  });

  xit('for Bob and Charlie', function () {
    var garden = new Garden('VVCCGG\nVVCCGG');
    expect(garden.bob).toEqual(['clover', 'clover', 'clover', 'clover']);
    expect(garden.charlie).toEqual(['grass', 'grass', 'grass', 'grass']);
  });
});

describe('Full garden', function () {
  var diagram = 'VRCGVVRVCGGCCGVRGCVCGCGV\nVRCCCGCRRGVCGCRVVCVGCGCV';
  var garden = new Garden(diagram);

  xit('for Alice', function () {
    expect(garden.alice)
      .toEqual(['violets', 'radishes', 'violets', 'radishes']);
  });

  xit('for Bob', function () {
    expect(garden.bob)
      .toEqual(['clover', 'grass', 'clover', 'clover']);
  });

  xit('for Charlie', function () {
    expect(garden.charlie)
      .toEqual(['violets', 'violets', 'clover', 'grass']);
  });

  xit('for David', function () {
    expect(garden.david)
      .toEqual(['radishes', 'violets', 'clover', 'radishes']);
  });

  xit('for Eve', function () {
    expect(garden.eve)
      .toEqual(['clover', 'grass', 'radishes', 'grass']);
  });

  xit('for Fred', function () {
    expect(garden.fred)
      .toEqual(['grass', 'clover', 'violets', 'clover']);
  });

  xit('for Ginny', function () {
    expect(garden.ginny)
      .toEqual(['clover', 'grass', 'grass', 'clover']);
  });

  xit('for Harriet', function () {
    expect(garden.harriet)
      .toEqual(['violets', 'radishes', 'radishes', 'violets']);
  });

  xit('for Ileana', function () {
    expect(garden.ileana)
      .toEqual(['grass', 'clover', 'violets', 'clover']);
  });

  xit('for Joseph', function () {
    expect(garden.joseph)
      .toEqual(['violets', 'clover', 'violets', 'grass']);
  });

  xit('for Kincaid', function () {
    expect(garden.kincaid)
      .toEqual(['grass', 'clover', 'clover', 'grass']);
  });

  xit('for Larry', function () {
    expect(garden.larry)
      .toEqual(['grass', 'violets', 'clover', 'violets']);
  });
});

describe('Disordered class', function () {
  var diagram = 'VCRRGVRG\nRVGCCGCV';
  var students = ['Samantha', 'Patricia', 'Xander', 'Roger'];
  var garden = new Garden(diagram, students);

  xit('Patricia', function () {
    expect(garden.patricia)
      .toEqual(['violets', 'clover', 'radishes', 'violets']);
  });

  xit('Roger', function () {
    expect(garden.roger)
      .toEqual(['radishes', 'radishes', 'grass', 'clover']);
  });

  xit('Samantha', function () {
    expect(garden.samantha)
      .toEqual(['grass', 'violets', 'clover', 'grass']);
  });

  xit('Xander', function () {
    expect(garden.xander)
      .toEqual(['radishes', 'grass', 'clover', 'violets']);
  });
});

describe('Two gardens, different students', function () {
  var diagram = 'VCRRGVRG\nRVGCCGCV';
  var garden1 = new Garden(diagram, ['Alice', 'Bob', 'Charlie', 'Dan']);
  var garden2 = new Garden(diagram, ['Bob', 'Charlie', 'Dan', 'Erin']);

  xit('Bob and Charlie for each garden', function () {
    expect(garden1.bob)
      .toEqual(['radishes', 'radishes', 'grass', 'clover']);
    expect(garden2.bob)
      .toEqual(['violets', 'clover', 'radishes', 'violets']);
    expect(garden1.charlie)
      .toEqual(['grass', 'violets', 'clover', 'grass']);
    expect(garden2.charlie)
      .toEqual(['radishes', 'radishes', 'grass', 'clover']);
  });
});