Skip to content
This repository was archived by the owner on Aug 5, 2022. It is now read-only.

Commit 46fdc14

Browse files
committed
add test for preid
1 parent 919cc8e commit 46fdc14

1 file changed

Lines changed: 38 additions & 0 deletions

File tree

test/index.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,4 +116,42 @@ describe('gulp-bump: JSON comparison fixtures', function() {
116116
bumpS.write(fakeFile);
117117
bumpS.end();
118118
});
119+
120+
it('should add and bump preid version', function(done) {
121+
var fakeFile = new gutil.File({
122+
contents: new Buffer('{ "version": "0.1.0"}'),
123+
path: 'test/fixtures/test.json'
124+
});
125+
126+
var bumpS = bump({type: 'prerelease', preid: 'beta'});
127+
128+
bumpS.once('data', function(newFile) {
129+
should.exist(newFile);
130+
should.exist(newFile.contents);
131+
console.log(String(newFile.contents));
132+
JSON.parse(newFile.contents.toString()).version.should.equal('0.1.1-beta.0');
133+
return done();
134+
});
135+
bumpS.write(fakeFile);
136+
bumpS.end();
137+
});
138+
139+
it('should bump preid version', function(done) {
140+
var fakeFile = new gutil.File({
141+
contents: new Buffer('{ "version": "0.1.0-zeta.1"}'),
142+
path: 'test/fixtures/test.json'
143+
});
144+
145+
var bumpS = bump({type: 'prerelease', preid: 'zeta'});
146+
147+
bumpS.once('data', function(newFile) {
148+
should.exist(newFile);
149+
should.exist(newFile.contents);
150+
console.log(String(newFile.contents));
151+
JSON.parse(newFile.contents.toString()).version.should.equal('0.1.0-zeta.2');
152+
return done();
153+
});
154+
bumpS.write(fakeFile);
155+
bumpS.end();
156+
});
119157
});

0 commit comments

Comments
 (0)