Skip to content

Commit

Permalink
move tags matching to db query - fix tag param regex
Browse files Browse the repository at this point in the history
  • Loading branch information
jgraff2 committed Aug 19, 2017
1 parent a6a10a0 commit 6ba7687
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
8 changes: 4 additions & 4 deletions api/v1/swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ paths:
items:
type: string
maxLength: 60
pattern: ^[0-9A-Za-z_\\-][0-9A-Za-z_]{1,59}$
pattern: ^[0-9A-Za-z_-]{1,60}$
description: >-
Comma-separated list of tags to include/exclude. Tag names are
case-insensitive. For example, ?tags=FOO,BAR will only return
Expand Down Expand Up @@ -1922,7 +1922,7 @@ paths:
items:
type: string
maxLength: 60
pattern: ^[0-9A-Za-z_\\-][0-9A-Za-z_]{1,59}$
pattern: ^[0-9A-Za-z_-]{1,60}$
description: >-
Comma-separated list of tags to include/exclude. Tag names are
case-insensitive. For example, ?tags=FOO,BAR will only return
Expand Down Expand Up @@ -2473,7 +2473,7 @@ paths:
items:
type: string
maxLength: 60
pattern: ^[0-9A-Za-z_\\-][0-9A-Za-z_]{1,59}$
pattern: ^[0-9A-Za-z_-]{1,60}$
description: >-
Comma-separated list of tags to include/exclude. Tag names are
case-insensitive. For example, ?tags=FOO,BAR will only return
Expand Down Expand Up @@ -5870,7 +5870,7 @@ paths:
items:
type: string
maxLength: 60
pattern: ^[0-9A-Za-z_\\-][0-9A-Za-z_]{1,59}$
pattern: ^[0-9A-Za-z_-]{1,60}$
description: >-
Comma-separated list of tags to include/exclude. Tag names are
case-insensitive. For example, ?tags=FOO,BAR will only return
Expand Down
24 changes: 23 additions & 1 deletion tests/api/v1/aspects/get.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ describe('tests/api/v1/aspects/get.js >', () => {
valueLabel: 'ms',
valueType: 'NUMERIC',
rank: 2,
tags: ['foo', 'baz'],
tags: ['foo', 'baz', 'foo-bar'],
}, {
description: 'this is a1 description',
helpEmail: 'a1@bar.com',
Expand Down Expand Up @@ -142,6 +142,28 @@ describe('tests/api/v1/aspects/get.js >', () => {
.end(done);
});

it('filter by single INCLUDE tags - tag has dash', (done) => {
api.get(path + '?tags=foo-bar')
.set('Authorization', token)
.expect(constants.httpStatus.OK)
.expect((res) => {
expect(res.body.length).to.equal(ONE);
expect(res.body[0].tags).to.contain('foo');
})
.end(done);
});

it('filter by single EXCLUDE tags - tag has dash', (done) => {
api.get(path + '?tags=-foo-bar')
.set('Authorization', token)
.expect(constants.httpStatus.OK)
.expect((res) => {
expect(res.body.length).to.equal(TWO);
expect(res.body[0].tags).to.contain('bar');
})
.end(done);
});

it('filter with tags - tag field not included', (done) => {
api.get(`${path}?tags=foo&fields=name,description`)
.set('Authorization', token)
Expand Down

0 comments on commit 6ba7687

Please sign in to comment.