ust-helloworld / The-Avengers-forming

This project is an application skeleton. It is used for a HKUST Software Engineering Course (COMP3111/H) in Fall 2016/17. My goal: The project is not asking students to re-produce the sample project. We should encourage students to do something better than the TA.
https://course.cse.ust.hk/comp3111/teamform/
MIT License
0 stars 6 forks source link

Unit test - initialize firebase problem #19

Open RaymondWongCH opened 7 years ago

RaymondWongCH commented 7 years ago

Writing tests for js files of the original version of base codes, I discover that initalizeFirebase() function declared in most of js files will cause error "Firebase App named '[DEFAULT]' already exists" when running unit test. To solve this problem, I use "firebase.apps.length === 0" to check whether Firebase is initalized or not. In this case, although the error seem to be fixed, I am concerned by whether this will affect the functionality of the website. Anyone have any opinions to this issue or can think of an alternative?

wai2016 commented 7 years ago

I think it is fine if you skip testing initalizeFirebase() function because 70-80% coverage is enough.

RaymondWongCH commented 7 years ago

The problem is that most js files given in the base code contains initalizeFirebase() function in their global scope. In other words, initalizeFirebase() function must be run when testing other function within the js files. It can't be simply skipped.

wai2016 commented 7 years ago

Oh then we have to check whether the addition code will affect the website or not first.