- add new testcase to validate inverse tag resolver
This commit is contained in:
@@ -114,3 +114,34 @@ it('Should filter tags correctly using the regex', async () => {
|
|||||||
|
|
||||||
expect(filtered).toStrictEqual(`api-0.0.1,api-0.0.1-rc01,api-10.1.0-2`)
|
expect(filtered).toStrictEqual(`api-0.0.1,api-0.0.1-rc01,api-10.1.0-2`)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it('Should filter tags correctly using the regex (inverse)', async () => {
|
||||||
|
const tags: TagInfo[] = [
|
||||||
|
{name: 'api-0.0.1', commit: ''},
|
||||||
|
{name: 'api-0.0.1-rc01', commit: ''},
|
||||||
|
{name: 'config-0.1.0', commit: ''},
|
||||||
|
{name: '0.1.0-b01', commit: ''},
|
||||||
|
{name: '1.0.0', commit: ''},
|
||||||
|
{name: '1.0.0-a01', commit: ''},
|
||||||
|
{name: '2.0.0', commit: ''},
|
||||||
|
{name: 'ap-10.0.0', commit: ''},
|
||||||
|
{name: '10.1.0', commit: ''},
|
||||||
|
{name: 'api-10.1.0-2', commit: ''},
|
||||||
|
{name: '20.0.2', commit: ''}
|
||||||
|
]
|
||||||
|
|
||||||
|
const tagResolver = {
|
||||||
|
method: 'non-existing-method',
|
||||||
|
filter: {
|
||||||
|
pattern: '^(?!\\w+-)(.+)',
|
||||||
|
flags: 'gu'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
const filtered = filterTags(tags, tagResolver)
|
||||||
|
.map(function (tag) {
|
||||||
|
return tag.name
|
||||||
|
})
|
||||||
|
.join(',')
|
||||||
|
|
||||||
|
expect(filtered).toStrictEqual(`0.1.0-b01,1.0.0,1.0.0-a01,2.0.0,10.1.0,20.0.2`)
|
||||||
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user