aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSascha <GlancingMind@outlook.com>2021-05-03 15:15:21 +0200
committerSascha <GlancingMind@outlook.com>2021-05-20 17:07:46 +0200
commit817732948d3b7cf0e7a4c2987cd0f7dd5729288b (patch)
tree7ae5efed1ccda19b6d5b9d7a5d8db0bb55493872
parent712c4073a71538b15784dd68a93dce8b1df0cf55 (diff)
downloadgit-bug-817732948d3b7cf0e7a4c2987cd0f7dd5729288b.tar.gz
Add test cases
Key:Value parsing test for quoated colon. E.g. label:"foo:bar" Key:Value:Value parsing test. E.g. metadata:key:"https://www.example.com/"
-rw-r--r--webui/src/__tests__/query.ts31
1 files changed, 21 insertions, 10 deletions
diff --git a/webui/src/__tests__/query.ts b/webui/src/__tests__/query.ts
index f8ff6360..7abcecd2 100644
--- a/webui/src/__tests__/query.ts
+++ b/webui/src/__tests__/query.ts
@@ -11,16 +11,6 @@ it('parses a query with multiple filters', () => {
foo: ['bar'],
baz: ['foo-bar'],
});
-});
-
-it('parses a quoted query', () => {
- expect(parse(`foo:"bar"`)).toEqual({
- foo: [`"bar"`],
- });
-
- expect(parse(`foo:'bar'`)).toEqual({
- foo: [`'bar'`],
- });
expect(parse(`label:abc freetext`)).toEqual({
label: [`abc`],
@@ -35,6 +25,17 @@ it('parses a quoted query', () => {
freetext: [''],
});
+});
+
+it('parses a quoted query', () => {
+ expect(parse(`foo:"bar"`)).toEqual({
+ foo: [`"bar"`],
+ });
+
+ expect(parse(`foo:'bar'`)).toEqual({
+ foo: [`'bar'`],
+ });
+
expect(parse(`label:'multi word label'`)).toEqual({
label: [`'multi word label'`],
});
@@ -51,6 +52,10 @@ it('parses a quoted query', () => {
label: [`"multi word label with 'nested' quotes"`],
});
+ expect(parse(`label:"with:quoated:colon"`)).toEqual({
+ label: [`"with:quoated:colon"`],
+ });
+
expect(parse(`foo:'escaped\\' quotes'`)).toEqual({
foo: [`'escaped\\' quotes'`],
});
@@ -70,6 +75,12 @@ it('parses a complex query', () => {
});
});
+it('parses a key:value:value query', () => {
+ expect(parse(`meta:github:"https://github.com/MichaelMure/git-bug"`)).toEqual({
+ meta: [`github:"https://github.com/MichaelMure/git-bug"`],
+ });
+});
+
it('quotes values', () => {
expect(quote(`foo`)).toEqual(`foo`);
expect(quote(`foo bar`)).toEqual(`"foo bar"`);