-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: Make previous list mandatory (#103)
* fix: Make previous list mandatory * Allow ignorePreviousList true if no prevArbifiedList is passed * Add versioning for extensions, add unit test * Get previous and current versions * Fix syntax * WIP * WIP * WIP * WIP * WIP * WIP * WIP * Cleanup * Add prevArbifiedList to integration tests * Fix prevArbifiedList in integration tests * Map over paths for backup * Fix paths * Fix paths * Fix paths * Update array type * Update paths access * Update paths access * Update paths access * Update paths access * Update paths access * Update paths access * Update paths access * WIP * WIP * WIP * Add all generation * Try error * Try error * Test happy path * Test happy path * Test happy path * Test error in online version * Test error in new version * Test error in backup * Remove tests * Simplify version parsing * Add missing parenthesis * Rework getVersion, remove previousList for fullList
- Loading branch information
1 parent
5fd7561
commit 003d528
Showing
10 changed files
with
488 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import { getVersion } from '../../src/lib/getVersion'; | ||
import { | ||
baseList, | ||
majorList, | ||
minorList, | ||
patchList, | ||
withoutExtensions, | ||
} from './getVersionMockup'; | ||
|
||
describe('getVersion', () => { | ||
it('Should return 1.0.0 version if no previous list is passed', () => { | ||
const version = getVersion(null, baseList().tokens); | ||
expect(version).toStrictEqual({ | ||
major: 1, | ||
minor: 0, | ||
patch: 0, | ||
}); | ||
|
||
const versionWithoutExtensions = getVersion( | ||
null, | ||
withoutExtensions(baseList().tokens), | ||
); | ||
expect(versionWithoutExtensions).toStrictEqual({ | ||
major: 1, | ||
minor: 0, | ||
patch: 0, | ||
}); | ||
}); | ||
|
||
it('Should not bump version if lists are equal', () => { | ||
const version = getVersion(baseList(), baseList().tokens); | ||
expect(version).toStrictEqual({ | ||
major: 2, | ||
minor: 3, | ||
patch: 4, | ||
}); | ||
|
||
const prevList = baseList(); | ||
const versionWithoutExtensions = getVersion( | ||
{ | ||
...prevList, | ||
tokens: withoutExtensions(prevList.tokens), | ||
}, | ||
withoutExtensions(baseList().tokens), | ||
); | ||
expect(versionWithoutExtensions).toStrictEqual({ | ||
major: 2, | ||
minor: 3, | ||
patch: 4, | ||
}); | ||
}); | ||
|
||
it('Should bump patch version if extensions are different', () => { | ||
const [prevList, newList] = patchList(); | ||
const version = getVersion(prevList, newList); | ||
expect(version).toStrictEqual({ | ||
major: 2, | ||
minor: 3, | ||
patch: 5, | ||
}); | ||
|
||
const versionWithoutExtensions = getVersion( | ||
{ | ||
...prevList, | ||
tokens: withoutExtensions(prevList.tokens), | ||
}, | ||
withoutExtensions(newList), | ||
); | ||
expect(versionWithoutExtensions).toStrictEqual({ | ||
major: 2, | ||
minor: 3, | ||
patch: 4, | ||
}); | ||
}); | ||
|
||
it('Should bump minor version if extensions are added', () => { | ||
const [prevList, newList] = minorList(); | ||
const version = getVersion(prevList, newList); | ||
expect(version).toStrictEqual({ | ||
major: 2, | ||
minor: 4, | ||
patch: 0, | ||
}); | ||
|
||
const versionWithoutExtensions = getVersion( | ||
{ | ||
...prevList, | ||
tokens: withoutExtensions(prevList.tokens), | ||
}, | ||
withoutExtensions(newList), | ||
); | ||
expect(versionWithoutExtensions).toStrictEqual({ | ||
major: 2, | ||
minor: 3, | ||
patch: 4, | ||
}); | ||
}); | ||
|
||
it('Should bump major version if extensions are removed', () => { | ||
const [prevList, newList] = majorList(); | ||
const version = getVersion(prevList, newList); | ||
expect(version).toStrictEqual({ | ||
major: 3, | ||
minor: 0, | ||
patch: 0, | ||
}); | ||
|
||
const versionWithoutExtensions = getVersion( | ||
{ | ||
...prevList, | ||
tokens: withoutExtensions(prevList.tokens), | ||
}, | ||
withoutExtensions(newList), | ||
); | ||
expect(versionWithoutExtensions).toStrictEqual({ | ||
major: 2, | ||
minor: 3, | ||
patch: 4, | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.