Add test cases and abstract into node module useable in node scripts