git: Auto replace spaces with underscores in version output. Allows versions to have spaces in their name while keeping it unix friendly folder and file name.
All checks were successful
continuous-integration/appveyor/branch AppVeyor build succeeded

This commit is contained in:
Jonatan Nilsson 2022-08-18 10:54:38 +00:00
parent 79f3203f70
commit 5d39f776e1
3 changed files with 21 additions and 2 deletions

View file

@ -29,7 +29,7 @@ export default class GitProvider {
if (this.config.git_required_prefix && !asset.name.startsWith(this.config.git_required_prefix)) continue
return {
version: item.name,
version: item.name.replace(/ /g, '_'),
link: asset.browser_download_url,
filename: asset.name,
description: item.body,

View file

@ -1,6 +1,6 @@
{
"name": "service-core",
"version": "3.0.0",
"version": "3.0.1",
"description": "Core boiler plate code to install node server as windows service",
"main": "index.mjs",
"scripts": {

View file

@ -20,6 +20,25 @@ t.describe('#getLatestVersion()', function() {
assert.strictEqual(version.log, '')
})
t.test('should auto replace spaces with underscores result', async function() {
const assertOriginalName = 'The Smell Of Sea'
const assertCorrectName = 'The_Smell_Of_Sea'
const assertLink = 'Over The Future'
const assertFilename = 'test-sc.7z'
let stubber = stub()
let provider = new GitProvider({}, stubber)
stubber.resolves({ body: [
{ name: assertOriginalName, assets: [{ name: assertFilename, browser_download_url: assertLink }] },
]})
let version = await provider.getLatestVersion()
assert.strictEqual(version.version, assertCorrectName)
assert.strictEqual(version.link, assertLink)
assert.strictEqual(version.filename, assertFilename)
assert.strictEqual(version.log, '')
})
t.test('should skip zip files for now', async function() {
const assertName = 'Karen'
const assertLink = 'My Wings'