Here is the explaination:
Your querystring contains: "01198-05282-01"
Lets take it in a variable:
var a= "01198-05282-01";
If we substring it,
a.substring(11,2)
It will return:
"198-05282"
You have parseInt in your code, hence
parseInt("198-05282");
will return
198
The substring() method returns a subset of a string between one
index and another, or through the end of the string.
So to get the desired output you need to,
var a= "01198-05282-01";
console.log(a.substring(12,14)) //returns "01"
with parseInt(a.substring(12,14),10) //will return 1
With your code:
var sequence = $stateParams.testId.length == 14 ?
parseInt($stateParams.testId.substring(12, 14), 10) : 0;
As
More about substring: https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/String/substring
As Tushar suggessted use radix as second parameter with parseInt
The parseInt() function parses a string argument and returns an integer of the specified radix (the base in mathematical numeral systems).
radix: An integer between 2 and 36 that represents the radix (the base in mathematical numeral systems) of the above mentioned string.
Specify 10 for the decimal numeral system commonly used by humans.
Always specify this parameter to eliminate reader confusion and to
guarantee predictable behavior. Different implementations produce
different results when a radix is not specified, usually defaulting
the value to 10.