storage: refactor tests to functions and split into multiple files