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.
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.
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:
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.