Crates.io | relm4-store-backend-dummy |
lib.rs | relm4-store-backend-dummy |
version | 0.1.0-beta.2 |
source | src |
created_at | 2022-01-09 20:43:58.020877 |
updated_at | 2022-01-21 11:00:00.328216 |
description | Dummy backend for relm4-store used for writing tests |
homepage | |
repository | https://github.com/mskorkowski/relm4-store |
max_upload_size | |
id | 510988 |
size | 37,383 |
This crate contains an implementation of the data store which is intended for testing/debugging code using store and store views.
Punch line
DummyBackend is a data store in which you manually control transition between states
As the consequence of "manual control" you are responsible on the correctness of the transitions. If you add some records during transition of the state but you don't provide the appropriate messages to be sent to store view please do not expect that store view is going to behave in any sane way.
Currently we just ignore incoming messages. Checking them in which order they were sent would be better.
For example if you expect Add and Remove events to be sent to empty store you would expect them in order of Add
first and Remove
later (in most cases). Since they can be interpreted as user adding and later removing record. If they come other way around Remove
will be considered noop by the store since there is no record to remove and add will leave one record in the store which would probably be a bad idea in such a case.
Tests for DummyBackend::get_range
are currently checking if returned collection has expected size but they are not checking if the returned vector has proper content.
This is something potentially against rule 1
. Current implementation is simple enough that I'm not so worried about. Nether the less it's definitely on the todo list to make it happen.