abstracted function in test.js