{"action":"closed","issue":{"url":"https://api.github.com/repos/bendrucker/discuss/issues/12","labels_url":"https://api.github.com/repos/bendrucker/discuss/issues/12/labels{/name}","comments_url":"https://api.github.com/repos/bendrucker/discuss/issues/12/comments","events_url":"https://api.github.com/repos/bendrucker/discuss/issues/12/events","html_url":"https://github.com/bendrucker/discuss/issues/12","id":60726019,"number":12,"title":"Clean up DB records during API tests","user":{"login":"demisx","id":4452412,"avatar_url":"https://avatars.githubusercontent.com/u/4452412?v=3","gravatar_id":"","url":"https://api.github.com/users/demisx","html_url":"https://github.com/demisx","followers_url":"https://api.github.com/users/demisx/followers","following_url":"https://api.github.com/users/demisx/following{/other_user}","gists_url":"https://api.github.com/users/demisx/gists{/gist_id}","starred_url":"https://api.github.com/users/demisx/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/demisx/subscriptions","organizations_url":"https://api.github.com/users/demisx/orgs","repos_url":"https://api.github.com/users/demisx/repos","events_url":"https://api.github.com/users/demisx/events{/privacy}","received_events_url":"https://api.github.com/users/demisx/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-03-11T20:40:22Z","updated_at":"2015-03-11T23:11:12Z","closed_at":"2015-03-11T23:11:12Z","body":"Hi Ben,\r\nI am running my API tests using `supertest` package. Some of these test create records in the database that affect total counts. Is there an approach you can recommend for returning DB to previous state after each test? I realize I can probably manually delete each model that I create in test, but wondering if there is a better, more automated approach. Maybe taking a DB snapshot before each test and restoring it after each test. Can you recommend anything from your experience?"}}