Skip to content

Instantly share code, notes, and snippets.

@radzserg
Last active October 4, 2019 12:30
Show Gist options
  • Select an option

  • Save radzserg/e53577a02d5e9c815c0c0832cefb8903 to your computer and use it in GitHub Desktop.

Select an option

Save radzserg/e53577a02d5e9c815c0c0832cefb8903 to your computer and use it in GitHub Desktop.
const repo = new PostsRepo(knex);
it("updates existing post", async () => {
await knex("users").insert({ id: 1, first_name: "John", last_name: "doe" });
await knex("posts").insert({ id: 2, user_id: 1, title: "Post Title", body: "body"});
repo.updatePost(1, { title: "title 2" });
const [updatedPost] = await knex("posts").where({ id: 2 });
expect(updatedPost.title).toEqual("title 2");
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment