Update tests to work with file add and upload events + refactor

Could someone from @meducation/dev-team sanity check this please.