refactor(stateSpec): add spy on .replace method