Skip to content

Commit

Permalink
MV #3 #20 : Se testea palabras extraidas de overview y reviews
Browse files Browse the repository at this point in the history
  • Loading branch information
LCinder committed Oct 31, 2021
1 parent 8783e20 commit 70a3fc1
Showing 1 changed file with 22 additions and 9 deletions.
31 changes: 22 additions & 9 deletions src/tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ import {assert} from "chai";
import {Movies} from "./movies";
import {Movie} from "./movie";

const movies = new Movies();
const movieObject = movies.find("Tenet");
const movie: Movie = new Movie(movies.convertJSON2Movie(movieObject));

describe("Quiero obtener informacion de una pelicula", () => {
const movies = new Movies();
const movieObject = movies.find("Tenet");
const movie: Movie = new Movie(movies.convertJSON2Movie(movieObject));

describe("Quiero obtener informacion de una pelicula", () => {
describe("Pelicula existe", () => {
it("Deberia existir", () => {
assert.exists(movie);
Expand All @@ -32,11 +32,6 @@ describe("Quiero obtener informacion de una pelicula", () => {
assert.isAtLeast(movie.voteAverage, 0);
assert.isAtMost(movie.voteAverage, 10);
});
/* it("Spy", () => {
const spy = sinon.spy(Movie.prototype, "addReview");
const movie2 = movies.find("Tenet");
assert.equal(spy.callCount, 5);
});*/
});
describe("Pelicula no existe", () => {
it("Salta error 'Movie does not exist'", () => {
Expand All @@ -46,4 +41,22 @@ describe("Quiero obtener informacion de una pelicula", () => {
}, "Movie does not exist");
});
});
});
describe("Quiero saber la clasificacion tematica de una pelicula", () => {
const keywords = movie.extractKeywords();

it("Deberia obtener array y no estar vacio", () => {
assert.isArray(keywords);
assert.isNotEmpty(keywords);
});
it("Deberia incluir keywords 'story', 'dragon', 'hobbit'", () => {
assert.include(keywords, ["story"]);
assert.include(keywords, ["dragon"]);
assert.include(keywords, ["hobbit"]);
});
it("Deberia incluir keywords basadas en gustos 'amazing', 'love', 'great'", () => {
assert.include(keywords, ["amazing"]);
assert.include(keywords, ["love"]);
assert.include(keywords, ["great"]);
});
});

0 comments on commit 70a3fc1

Please sign in to comment.