add unit test for flushing