Add unit tests and mocks