forked from AkkomaGang/akkoma-fe
Merge branch '580' into 'develop'
Fix backend version string parsing Closes #580 See merge request pleroma/pleroma-fe!868
This commit is contained in:
commit
c8794b2b84
2 changed files with 12 additions and 1 deletions
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
export const extractCommit = versionString => {
|
export const extractCommit = versionString => {
|
||||||
const regex = /-g(\w+)$/i
|
const regex = /-g(\w+)/i
|
||||||
const matches = versionString.match(regex)
|
const matches = versionString.match(regex)
|
||||||
return matches ? matches[1] : ''
|
return matches ? matches[1] : ''
|
||||||
}
|
}
|
||||||
|
|
11
test/unit/specs/services/version/version.service.spec.js
Normal file
11
test/unit/specs/services/version/version.service.spec.js
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
import { extractCommit } from 'src/services/version/version.service.js'
|
||||||
|
|
||||||
|
describe('extractCommit', () => {
|
||||||
|
it('return short commit hash following "-g" characters', () => {
|
||||||
|
expect(extractCommit('1.0.0-45-g5e7aeebc')).to.eql('5e7aeebc')
|
||||||
|
})
|
||||||
|
|
||||||
|
it('return short commit hash without branch name', () => {
|
||||||
|
expect(extractCommit('1.0.0-45-g5e7aeebc-branch')).to.eql('5e7aeebc')
|
||||||
|
})
|
||||||
|
})
|
Loading…
Reference in a new issue