-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
|
||
import "mocha"; | ||
import {assert} from "chai"; | ||
import {server} from "../src/routes"; | ||
|
||
|
||
describe("GET /status", () => { | ||
it("Deberia devolver en body 'Ok'", async () => { | ||
const res = await server.inject({ | ||
url: "/status" | ||
}); | ||
assert.include(res.body, "Ok"); | ||
assert.equal(res.statusCode, 200); | ||
}); | ||
}); | ||
|
||
describe("GET /movies", () => { | ||
it("Deberia ser un array con varios elementos", async () => { | ||
const res = await server.inject({ | ||
url: "/movies" | ||
}); | ||
assert.isAbove(res.body.length, 2); | ||
assert.equal(res.statusCode, 200); | ||
}); | ||
}); | ||
|
||
describe("GET /movies/Hobbit", () => { | ||
it("Deberia ser una pelicula", async () => { | ||
const res = await server.inject({ | ||
url: "/movies/Hobbit(2012)" | ||
}); | ||
assert.equal(JSON.parse(res.body)._title, "The Hobbit: An Unexpected Journey"); | ||
assert.equal(res.statusCode, 200); | ||
}); | ||
}); | ||
|
||
describe("GET /movies/Hobbit/keywords", () => { | ||
it("Deberia devolver un array de palabras clave 'string'", async () => { | ||
const res = await server.inject({ | ||
url: "/movies/Hobbit(2012)/keywords" | ||
}); | ||
assert.isArray(JSON.parse(res.body)); | ||
assert.isAbove(res.body.length, 2); | ||
assert.equal(res.statusCode, 200); | ||
}); | ||
}); |