1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-10-23 03:36:18 +02:00
metamask-extension/test/unit/development/version–bump-test.js
Whymarrh Whitby 92971d3c87
Migrate codebase to use ESM (#7730)
* Update eslint-plugin-import version

* Convert JS files to use ESM

* Update ESLint rules to check imports

* Fix test:unit:global command env

* Cleanup mock-dev script
2020-01-09 00:04:58 -03:30

47 lines
1.6 KiB
JavaScript

import assert from 'assert'
import versionBump from '../../../development/version-bump'
import promisify from 'pify'
import fs from 'fs'
const readFile = promisify(fs.readFile)
import path from 'path'
const changelogPath = path.join(__dirname, 'sample-changelog.md')
import manifest from './sample-manifest.json'
let changelog
describe('version bumper', function () {
beforeEach(async () => {
// load changelog. Mock version is 4.1.3
const changeBuffer = await readFile(changelogPath)
changelog = changeBuffer.toString()
})
it('returns a properly bumped major version', async function () {
const result = await versionBump('major', changelog, manifest)
const expected = '5.0.0'
assert.equal(result.version, expected, 'major bumps correctly')
assert.equal(result.manifest.version, expected, 'major bumps correctly')
assert.ok(result.changelog.includes(expected))
})
it('returns a properly bumped minor version', async function () {
const result = await versionBump('minor', changelog, manifest)
const expected = '4.2.0'
assert.equal(result.version, expected, 'minor bumps correctly')
assert.equal(result.manifest.version, expected, 'minor bumps correctly')
assert.ok(result.changelog.includes(expected))
})
it('returns a properly bumped patch version', async function () {
const result = await versionBump('patch', changelog, manifest)
const expected = '4.1.4'
assert.equal(result.version, expected, 'patch bumps correctly')
assert.equal(result.manifest.version, expected, 'patch bumps correctly')
assert.ok(result.changelog.includes(expected))
})
})