tests: add tests and logic