wal: add tests for write