@@ -8,6 +8,11 @@ import {GithubImportsGo} from '../../src/updaters/go/github-imports-go';
88const fixturesPath = './test/updaters/fixtures' ;
99
1010describe ( 'GithubImportsGo' , ( ) => {
11+ const v1File = readFileSync (
12+ resolve ( fixturesPath , 'file-with-imports-v1.go' ) ,
13+ 'utf8'
14+ ) ;
15+
1116 const v2File = readFileSync (
1217 resolve ( fixturesPath , 'file-with-imports-v2.go' ) ,
1318 'utf8'
@@ -18,14 +23,28 @@ describe('GithubImportsGo', () => {
1823 'utf8'
1924 ) ;
2025
21- it ( 'makes no changes if the new version has a major version of 2' , async ( ) => {
26+ it ( 'makes no changes if the old version has a major version of 1 and the new version also has a major version of 1' , async ( ) => {
27+ const readmeUpdater = new GithubImportsGo ( {
28+ version : Version . parse ( '1.0.0' ) ,
29+ } ) ;
30+ expect ( readmeUpdater . updateContent ( v1File ) ) . to . equal ( v1File ) ;
31+ } ) ;
32+
33+ it ( 'updates the version in the imports if the old version has a major version of 1 and the new version has a major version of 2' , async ( ) => {
34+ const readmeUpdater = new GithubImportsGo ( {
35+ version : Version . parse ( '2.0.0' ) ,
36+ } ) ;
37+ expect ( readmeUpdater . updateContent ( v1File ) ) . to . equal ( v2File ) ;
38+ } ) ;
39+
40+ it ( 'makes no changes if the old version has a major version of 2 and the new version also has a major version of 2' , async ( ) => {
2241 const readmeUpdater = new GithubImportsGo ( {
2342 version : Version . parse ( '2.0.0' ) ,
2443 } ) ;
2544 expect ( readmeUpdater . updateContent ( v2File ) ) . to . equal ( v2File ) ;
2645 } ) ;
2746
28- it ( 'updates the version in the imports if the new version has a major version of 3' , async ( ) => {
47+ it ( 'updates the version in the imports if the old version has a major version of 2 and the new version has a major version of 3' , async ( ) => {
2948 const readmeUpdater = new GithubImportsGo ( {
3049 version : Version . parse ( '3.0.0' ) ,
3150 } ) ;
0 commit comments