Skip to content

Commit 74d0d86

Browse files
committed
test(inc): ensure SemVer instanced passed as input are not modified
1 parent e7c3973 commit 74d0d86

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

test/functions/inc.js

+4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ test('increment versions test', (t) => {
1010
t.equal(found, wanted, `${cmd} === ${wanted}`)
1111

1212
const parsed = parse(pre, options)
13+
const parsedAsInput = parse(pre, options)
1314
if (wanted) {
1415
parsed.inc(what, id)
1516
t.equal(parsed.version, wanted, `${cmd} object version updated`)
1617
t.equal(parsed.raw, wanted, `${cmd} object raw field updated`)
18+
19+
inc(parsedAsInput, what, options, id)
20+
t.equal(parsedAsInput.version, pre, `${cmd} didn't modify its input`)
1721
} else if (parsed) {
1822
t.throws(() => {
1923
parsed.inc(what, id)

0 commit comments

Comments
 (0)