GUBookSociety / uofg-book-society-website

A website created with Angular for the Glasgow University Book Society. (IN DEVELOPMENT)
1 stars 0 forks source link

Create tests for the forms on /form #20

Open liamlau opened 4 years ago

liamlau commented 4 years ago

As with everything else in the app, we need tests to make sure we don't break anything when we make changes. Luke implemented the first part of real functionality in the app, so we just need to check that it properly adds, removes and reads things from the Firebase Firestore.

The thing to remember is though: we need to mock this. What I mean by that, is that, we don't want to read from the actual database every time we test, as we are currently on the free plan, and we don't want to use up the reads/writes from testing.

We need to look up how to mock a Firebase Firestore database, and how to test in Angular (unit and e2e) in such a way that we don't ever interact with the real database.

liamlau commented 4 years ago

This is the corresponding testing issue for #16.

liamlau commented 4 years ago

Currently unassigned: anyone who would like to do this, just assign yourself 😄

LukeGall commented 4 years ago

A test has been created using a Spy to check that the book-list component will get data from the firebase using the bookService, this test doesn't access the firebase however and uses mock data

LukeGall commented 4 years ago

Commit added with three basic tests. Firebase mocking is possible but more research is needed but first the model should be designed and make so we can check the correct data is returned. Currently it only returns 'data' instead of say a Book model making it harder to test