Raccoon-Influencer-Search/app.test.js
2024-02-25 16:55:59 +01:00

31 lines
584 B
JavaScript

"use strict";
const { test } = require("tap");
const build = require("./app");
const models = require("./models");
const Game = models.Game;
Game.sync().then(async () => {
Game.create({
name: "Jablanica",
});
Game.create({
name: "Stockholm",
});
});
test('requests the "/" route', async (t) => {
const app = build();
const response = await app.inject({
method: "GET",
url: "/",
});
const responseBody = JSON.parse(response.body);
t.equal(response.statusCode, 200, "returns a status code of 200");
t.equal(responseBody.games.length, 2);
});