add seed moves

This commit is contained in:
Sorrel Bri 2020-01-29 23:44:06 -08:00
parent 09e90c97ab
commit 3aeadb48cd
2 changed files with 54 additions and 1 deletions

View file

@ -0,0 +1,14 @@
exports.seed = function(knex) {
// Deletes ALL existing entries
return knex('move').del()
.then(function () {
// Inserts seed entries
return knex('move').insert([
{id: 1, player: 'black', point_x: 3, point_y: 3, number: 1, game_record: true, game: 1, prior_move: null},
{id: 2, player: 'white', point_x: 15, point_y: 15, number: 2, game_record: true, game: 1, prior_move: 1},
{id: 3, player: 'black', point_x: 4, point_y: 15, number: 3, game_record: true, game: 1, prior_move: 2},
{id: 4, player: 'white', point_x: 15, point_y: 4, number: 4, game_record: true, game: 1, prior_move: 3},
]);
});
};

View file

@ -31,7 +31,46 @@ const apiRoomSpec = (chai, knex, server) => {
}
const recordOne = [
// {}
{
game: 1,
game_record: true,
id: 1,
number: 1,
player: "black",
point_x: 3,
point_y: 3,
prior_move: null
},
{
game: 1,
game_record: true,
id: 2,
number: 2,
player: "white",
point_x: 15,
point_y: 15,
prior_move: 1
},
{
game: 1,
game_record: true,
id: 3,
number: 3,
player: "black",
point_x: 4,
point_y: 15,
prior_move: 2,
},
{
game: 1,
game_record: true,
id: 4,
number: 4,
player: "white",
point_x: 15,
point_y: 4,
prior_move: 3,
}
]
it('request to api games/1 should return 1 room game information with moves', done => {