{
"title": "GOOD JSON SEARCH TESTS",
"desc": "testing incorrect JSON output from lists and searches.",
"tests": [
{
"name": "empty search by title keyword",
"cmds": [
["new-profile"],
["add", "a title this is"],
["add", "not in here"],
["search", "muhahahaha", "-j"]
],
"result_type": "json",
"results": [
null,
null,
null,
[]
]
},{
"name": "search notes by title keyword",
"cmds": [
["new-profile"],
["add", "a title this is"],
["add", "not in here"],
["search", "this", "-j"]
],
"result_type": "json",
"results": [
null,
null,
null,
[
{
"id": 1,
"title": "a title this is",
"status": "",
"body": ""
}
]
]
},{
"name": "search for some notes by title keyword",
"cmds": [
["new-profile"],
["add", "a title this is"],
["add", "not here"],
["add", "this has it"],
["search", "this", "-j"]
],
"result_type": "json",
"results": [
null,
null,
null,
null,
[
{
"id": 1,
"title": "a title this is",
"status": "",
"body": ""
},{
"id": 3,
"title": "this has it",
"status": "",
"body": ""
}
]
]
},{
"name": "search some for notes by title keyword, limited",
"cmds": [
["new-profile"],
["add", "a title this is"],
["add", "not here"],
["add", "this has it"],
["search", "this", "-j", "-l", "1"]
],
"result_type": "json",
"results": [
null,
null,
null,
null,
[
{
"id": 1,
"title": "a title this is",
"status": "",
"body": ""
}
]
]
},{
"name": "search for some notes by title keyword, reversed",
"cmds": [
["new-profile"],
["add", "a title this is"],
["add", "not here"],
["add", "this has it"],
["search", "this", "-j", "-r"]
],
"result_type": "json",
"results": [
null,
null,
null,
null,
[
{
"id": 3,
"title": "this has it",
"status": "",
"body": ""
},{
"id": 1,
"title": "a title this is",
"status": "",
"body": ""
}
]
]
},{
"name": "search for some notes by title keyword, reversed and limited",
"cmds": [
["new-profile"],
["add", "a title this is"],
["add", "not here"],
["add", "this has it"],
["search", "this", "-j", "-r", "-l", "1"]
],
"result_type": "json",
"results": [
null,
null,
null,
null,
[
{
"id": 3,
"title": "this has it",
"status": "",
"body": ""
}
]
]
},{
"name": "search for a note by body keyword",
"cmds": [
["new-profile"],
["add", "my journal", "-b", "I like this but not those things wizards do."],
["add", "my journal", "-b", "I too dislike those with the pointy hats."],
["add", "my journal", "-b", "i liek magic"],
["search", "magic", "-j", "--search-body"]
],
"result_type": "json",
"results": [
null,
null,
null,
null,
[
{
"id": 3,
"title": "my journal",
"status": "",
"body": "i liek magic"
}
]
]
},{
"name": "search some notes by body keyword",
"cmds": [
["new-profile"],
["add", "my journal", "-b", "magic is fuuuuun"],
["add", "my journal", "-b", "I too dislike those with the pointy hats."],
["add", "my journal", "-b", "i liek magic"],
["search", "magic", "-j", "--search-body"]
],
"result_type": "json",
"results": [
null,
null,
null,
null,
[
{
"id": 1,
"title": "my journal",
"status": "",
"body": "magic is fuuuuun"
},{
"id": 3,
"title": "my journal",
"status": "",
"body": "i liek magic"
}
]
]
},{
"name": "search for a note by body regex",
"cmds": [
["new-profile"],
["add", "my journal", "-b", "I like this but not those things wizards do."],
["add", "my journal", "-b", "this is my email derrrr@test.com"],
["add", "my journal", "-b", "i liek magic"],
["search", "\\S+@\\S+", "-j", "--search-body", "--regex"]
],
"result_type": "json",
"results": [
null,
null,
null,
null,
[
{
"id": 2,
"title": "my journal",
"status": "",
"body": "this is my email derrrr@test.com"
}
]
]
},{
"name": "search some notes by body regex",
"cmds": [
["new-profile"],
["add", "my journal", "-b", "this that other persons email dewwww@test.com"],
["add", "my journal", "-b", "I too dislike those with the pointy hats."],
["add", "my journal", "-b", "this is my email derrrr@test.com"],
["search", "\\S+@\\S+", "-j", "--search-body", "--regex"]
],
"result_type": "json",
"results": [
null,
null,
null,
null,
[
{
"id": 1,
"title": "my journal",
"status": "",
"body": "this that other persons email dewwww@test.com"
},{
"id": 3,
"title": "my journal",
"status": "",
"body": "this is my email derrrr@test.com"
}
]
]
},{
"name": "search some notes by body regex, reversed",
"cmds": [
["new-profile"],
["add", "my journal", "-b", "this that other persons email dewwww@test.com"],
["add", "my journal", "-b", "I too dislike those with the pointy hats."],
["add", "my journal", "-b", "this is my email derrrr@test.com"],
["search", "\\S+@\\S+", "-j", "--search-body", "--regex", "-r"]
],
"result_type": "json",
"results": [
null,
null,
null,
null,
[
{
"id": 3,
"title": "my journal",
"status": "",
"body": "this is my email derrrr@test.com"
},{
"id": 1,
"title": "my journal",
"status": "",
"body": "this that other persons email dewwww@test.com"
}
]
]
},{
"name": "search some notes by body regex, limit",
"cmds": [
["new-profile"],
["add", "my journal", "-b", "this that other persons email dewwww@test.com"],
["add", "my journal", "-b", "I too dislike those with the pointy hats."],
["add", "my journal", "-b", "this is my email derrrr@test.com"],
["search", "\\S+@\\S+", "-j", "--search-body", "--regex", "-l", "1"]
],
"result_type": "json",
"results": [
null,
null,
null,
null,
[
{
"id": 1,
"title": "my journal",
"status": "",
"body": "this that other persons email dewwww@test.com"
}
]
]
},{
"name": "search some notes by body regex, reversed and limited",
"cmds": [
["new-profile"],
["add", "my journal", "-b", "this that other persons email dewwww@test.com"],
["add", "my journal", "-b", "I too dislike those with the pointy hats."],
["add", "my journal", "-b", "this is my email derrrr@test.com"],
["search", "\\S+@\\S+", "-j", "--search-body", "--regex", "-r", "-l", "1"]
],
"result_type": "json",
"results": [
null,
null,
null,
null,
[
{
"id": 3,
"title": "my journal",
"status": "",
"body": "this is my email derrrr@test.com"
}
]
]
}
]
}