refactor resource parser logic & fixed the test