[tests] Backend tests + refactoring of epic queries