Skip to content

Instantly share code, notes, and snippets.

@labra
Last active November 21, 2018 13:04
Show Gist options
  • Save labra/660f4944af612fef2f26 to your computer and use it in GitHub Desktop.
Save labra/660f4944af612fef2f26 to your computer and use it in GitHub Desktop.
CursoTest
const assert = require('assert');
const { Curso } = require("../Curso");
describe('Curso', function() {
describe('Gestión de cursos', function() {
it('debe crear un curso', function() {
var c = new Curso("C1")
assert.equal("C1",c.getNombre());
});
it('debe añadir un alumno y buscar su nota', function() {
var c = new Curso("C1")
c.ponNota(12,2.3);
assert.equal(2.3,c.getNota(12));
});
it('debe añadir 2 alumnos y buscar la nota del primero', function() {
var c = new Curso("C1")
c.ponNota(12,2.3);
c.ponNota(33,6);
assert.equal(2.3,c.getNota(12));
});
it('debe añadir 2 alumnos y buscar la nota del segundo', function() {
var c = new Curso("C1")
c.ponNota(12,2.3);
c.ponNota(33,6);
assert.equal(6,c.getNota(33));
});
it('debe añadir 2 alumnos y calcular la media', function() {
var c = new Curso("C1")
c.ponNota(12,2.3);
c.ponNota(33,6);
assert.equal(4.15,c.media());
});
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment