Sha256: 4f2b9bd9a40720ccea739f969d5ee088d14938e7312fef698e30101cc1867d75

Contents?: true

Size: 1.75 KB

Versions: 141

Compression:

Stored size: 1.75 KB

Contents

var School = require('./grade-school');

describe('School', function () {
  var school;

  beforeEach(function () {
    school = new School();
  });

  it('a new school has an empty roster', function () {
    expect(school.roster()).toEqual({});
  });

  xit('adding a student adds them to the roster for the given grade', function () {
    school.add('Aimee', 2);
    var expectedDb = { 2: [ 'Aimee' ] };
    expect(school.roster()).toEqual(expectedDb);
  });

  xit('adding more students to the same grade adds them to the roster', function () {
    school.add('Blair', 2);
    school.add('James', 2);
    school.add('Paul', 2);
    var expectedDb = { 2: [ 'Blair', 'James', 'Paul' ] };
    expect(school.roster()).toEqual(expectedDb);
  });

  xit('adding students to different grades adds them to the roster', function () {
    school.add('Chelsea', 3);
    school.add('Logan', 7);
    var expectedDb = { 3: [ 'Chelsea' ], 7: [ 'Logan' ] };
    expect(school.roster()).toEqual(expectedDb);
  });

  xit('grade returns the students in that grade in alphabetical order', function () {
    school.add('Franklin', 5);
    school.add('Bradley', 5);
    school.add('Jeff', 1);
    var expectedStudents = [ 'Bradley', 'Franklin' ];
    expect(school.grade(5)).toEqual(expectedStudents);
  });

  xit('grade returns an empty array if there are no students in that grade', function () {
    expect(school.grade(1)).toEqual([]);
  });

  xit('the students names in each grade in the roster are sorted', function () {
    school.add('Jennifer', 4);
    school.add('Kareem', 6);
    school.add('Christopher', 4);
    school.add('Kyle', 3);
    var sorted = {
      3: [ 'Kyle' ],
      4: [ 'Christopher', 'Jennifer' ],
      6: [ 'Kareem' ]
    };
    expect(school.roster()).toEqual(sorted);
  });
});

Version data entries

141 entries across 141 versions & 1 rubygems

Version Path
trackler-2.2.1.119 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.118 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.117 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.116 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.115 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.114 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.113 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.111 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.110 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.109 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.108 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.107 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.106 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.105 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.104 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.103 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.102 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.101 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.100 tracks/javascript/exercises/grade-school/grade-school.spec.js
trackler-2.2.1.99 tracks/javascript/exercises/grade-school/grade-school.spec.js