Skip to content

Conversation

@kfc35
Copy link

@kfc35 kfc35 commented Oct 10, 2025

This pull request contains some VERY basic test_helper methods for inserting data into postgres and es. Personally I am wanting for more… like setting up some transactional testing framework of a sort within a test… but this is a small step towards something. Having specific test data closer to tests instead of having to search for them in a big fixture file is better in my opinion, but I will not be offended if this pull is rejected if there is a desire for something more comprehensive. One can use before / beforeEach / after / afterEach to do inserts and deletes for a suite of tests in the meantime.

The associated tests serves as examples of usage, and both are related to issues I am working on, so they are perfectly fine to include into the codebase.

Helps with #140

I noticed the tests I wrote are a little on the slower side, though, presumably because of the inserts and deletes (30-70ms, yellow range usually).

I’m admittedly not an expert at async/await so feel free to look at the usage more critically

expect( res.body.results.length ).to.eq( 1 );
expect( res.body.results.map( r => r.id ) ).to.contain( observationES.id );
} ).expect( 200 );
} finally {
Copy link
Author

@kfc35 kfc35 Oct 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if a test fails, it throws, so this finally block ensures the test specific data is wiped

@kfc35 kfc35 force-pushed the 140-basic-test-helpers branch from 6ed529d to ab4ecfd Compare October 11, 2025 00:53
@kfc35 kfc35 force-pushed the 140-basic-test-helpers branch from ab4ecfd to 9effe36 Compare October 11, 2025 01:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant