riverpod icon indicating copy to clipboard operation
riverpod copied to clipboard

Let `Storage.inMemory` accept a map for initial test/mock data

Open TekExplorer opened this issue 9 months ago • 1 comments

Currently, Storage.inMemory() does not take any parameters.

The constructor is useful for tests, as it does not require a real backend.

However, If you wanted to ensure that some data was already saved, you'd be forced to manually write it before returning the object.

It would be really nice if we could specify "initial data" for certain tests

TekExplorer avatar May 16 '25 03:05 TekExplorer

You can use ..

Storage.inMemory()..write(key, value)..write(key,value)

rrousselGit avatar May 16 '25 03:05 rrousselGit

Not planned for now.

The reason is options (such as destroyKey and co). The syntax wouldn't be very convenient when .. already exists

rrousselGit avatar Jun 20 '25 12:06 rrousselGit