Thanks for visiting! It’s actually the way I wrote is confusing. If you print out the minimum values after applying standardScalar, they will be either zero (definitely in training set) or very close to zero (for test set) and the maximum values will be either 1 or close to 1.
But I also understand your point that main purpose of using standardScalar is to have features with zero mean and unit variance. This is not what I meant in the comment of the code. You can think why all the training data-set features will have zero minimum and 1 maximum but not the test data-set as a side topic.