Add tests for trim functionality