- format code
This commit is contained in:
@@ -8,22 +8,22 @@ clear()
|
||||
it('Replace into target', async () => {
|
||||
const regex: Regex = {
|
||||
pattern: '.*(\\[Feature\\]|\\[Issue\\]).*',
|
||||
target: '$1',
|
||||
target: '$1'
|
||||
}
|
||||
const validatedRegex = validateRegex(regex)
|
||||
expect(validateRegex).not.toBeNull()
|
||||
expect(transformStringToValue("[Feature] TEST", validatedRegex!!)).toStrictEqual(`[Feature]`)
|
||||
expect(transformStringToValue('[Feature] TEST', validatedRegex!!)).toStrictEqual(`[Feature]`)
|
||||
})
|
||||
|
||||
it('Replace all into target', async () => {
|
||||
const regex: Regex = {
|
||||
pattern: '.*(\\[Feature\\]|\\[Issue\\]).*',
|
||||
method: 'replaceAll',
|
||||
target: '$1',
|
||||
target: '$1'
|
||||
}
|
||||
const validatedRegex = validateRegex(regex)
|
||||
expect(validateRegex).not.toBeNull()
|
||||
expect(transformStringToValue("[Feature] TEST", validatedRegex!!)).toStrictEqual(`[Feature]`)
|
||||
expect(transformStringToValue('[Feature] TEST', validatedRegex!!)).toStrictEqual(`[Feature]`)
|
||||
})
|
||||
|
||||
it('Match without target', async () => {
|
||||
@@ -33,27 +33,27 @@ it('Match without target', async () => {
|
||||
}
|
||||
const validatedRegex = validateRegex(regex)
|
||||
expect(validateRegex).not.toBeNull()
|
||||
expect(transformStringToValue("[Feature] TEST", validatedRegex!!)).toStrictEqual(`[Feature]`)
|
||||
expect(transformStringToValue('[Feature] TEST', validatedRegex!!)).toStrictEqual(`[Feature]`)
|
||||
})
|
||||
|
||||
it('Match into target', async () => {
|
||||
const regex: Regex = {
|
||||
pattern: '(?<label>\\[Feature\\]|\\[Issue\\])',
|
||||
method: 'match',
|
||||
target: '$1',
|
||||
target: '$1'
|
||||
}
|
||||
const validatedRegex = validateRegex(regex)
|
||||
expect(validateRegex).not.toBeNull()
|
||||
expect(transformStringToValue("[Feature] TEST", validatedRegex!!)).toStrictEqual(`[Feature]`)
|
||||
expect(transformStringToValue('[Feature] TEST', validatedRegex!!)).toStrictEqual(`[Feature]`)
|
||||
})
|
||||
|
||||
it('Match into named group', async () => {
|
||||
const regex: Regex = {
|
||||
pattern: '(?<label>\\[Feature\\]|\\[Issue\\])',
|
||||
method: 'match',
|
||||
target: 'label',
|
||||
target: 'label'
|
||||
}
|
||||
const validatedRegex = validateRegex(regex)
|
||||
expect(validateRegex).not.toBeNull()
|
||||
expect(transformStringToValue("[Feature] TEST", validatedRegex!!)).toStrictEqual(`[Feature]`)
|
||||
expect(transformStringToValue('[Feature] TEST', validatedRegex!!)).toStrictEqual(`[Feature]`)
|
||||
})
|
||||
@@ -154,7 +154,6 @@ it('Should filter tags correctly using the regex (inverse)', async () => {
|
||||
expect(filtered).toStrictEqual(`0.1.0-b01,1.0.0,1.0.0-a01,2.0.0,10.1.0,20.0.2`)
|
||||
})
|
||||
|
||||
|
||||
it('Should transform tags correctly using the regex', async () => {
|
||||
const tags: TagInfo[] = [
|
||||
{name: 'api-0.0.1', commit: ''},
|
||||
@@ -170,8 +169,8 @@ it('Should transform tags correctly using the regex', async () => {
|
||||
const tagResolver: TagResolver = {
|
||||
method: 'non-existing-method',
|
||||
transformer: {
|
||||
pattern: '(api\-)?(.+)',
|
||||
target: "$2"
|
||||
pattern: '(api-)?(.+)',
|
||||
target: '$2'
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user