rapido-mobile / rapido-flutter

Library for RAD development in Flutter
BSD 2-Clause "Simplified" License
70 stars 13 forks source link

Add ability to synchronously create a document list with persisted data #121

Closed rickspencer3 closed 5 years ago

rickspencer3 commented 5 years ago

This change supports testability. Previously, tests could easily be pass even if the documents were not loaded because documentsLoaded would not fire if there was an issue loading the documents.

This change allows a test to be written like:

    DocumentList loadedDocumentList =
        await DocumentList.createDocumentList("testDocumentType");
    expect(loadedDocumentList.length, 2);

so that the expect function will always run after the createDocumentList function runs and completes.

In order to make this work, I added a "autoLoad" parameter which defaults to true in the DocumentList constructor. This is called set to false in the createDocumentList call into the constructor.

I fixed tests to use the new pattern.

While I was fixing those tests, I removed some tests that I realized were useful.