Closed alexstaroselsky closed 4 years ago
Please try reverting getPreviousVersion
to its original state then run the new tests to see the issues in action. As getPreviousVersion
seems to get version 0.0.0
each and every time, this becomes an issue only when there are more than 2 versions, as in when saving 2.0.0
with default settings.
I would expect that version 2.0.0
should compare/diff against 1.0.0
, not 0.0.0
as well as store the diff between 1.0.0
and 2.0.0
when 2.0.0
is being created, rather than between 0.0.0
and 2.0.0
. This is the primary goal of this change. That being said, also added some tests to demonstrate behavior of getVersion
in which passing a version that does not exist, but is a valid semver version, returns the latest version in it's current implemention.
This looks to extend to other functions such as getVersion
, getVersions
and compareVersions
as they depend on patches. This is really evident with arrays where duplicates and excess items after version 1.0.0 start occurring.
@Masquerade-Circus Hello, hope is all is well. Did you happen to have a chance to look at this issue and/or changes? Let me know your thoughts or what I can do to help. Thanks!
Updated getPreviousVersion method logic to grab the last item in the in the versions array. Previously it was always getting version "0.0.0" which was leading to adverse behavior in diff.
BREAKING CHANGE: Saved diff for histories with more than 2 versions could result in different diff than previous behavior.