Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
drewdaemon committed Jul 9, 2024
1 parent 7deb85c commit 7b5c359
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11006,6 +11006,13 @@
"error": [],
"warning": []
},
{
"query": "from a_index | eval date_extract(\"SOME_RANDOM_STRING\", now())",
"error": [],
"warning": [
"Invalid option [\"SOME_RANDOM_STRING\"] for date_extract. Supported options: [\"ALIGNED_DAY_OF_WEEK_IN_MONTH\", \"ALIGNED_DAY_OF_WEEK_IN_YEAR\", \"ALIGNED_WEEK_OF_MONTH\", \"ALIGNED_WEEK_OF_YEAR\", \"AMPM_OF_DAY\", \"CLOCK_HOUR_OF_AMPM\", \"CLOCK_HOUR_OF_DAY\", \"DAY_OF_MONTH\", \"DAY_OF_WEEK\", \"DAY_OF_YEAR\", \"EPOCH_DAY\", \"ERA\", \"HOUR_OF_AMPM\", \"HOUR_OF_DAY\", \"INSTANT_SECONDS\", \"MICRO_OF_DAY\", \"MICRO_OF_SECOND\", \"MILLI_OF_DAY\", \"MILLI_OF_SECOND\", \"MINUTE_OF_DAY\", \"MINUTE_OF_HOUR\", \"MONTH_OF_YEAR\", \"NANO_OF_DAY\", \"NANO_OF_SECOND\", \"OFFSET_SECONDS\", \"PROLEPTIC_MONTH\", \"SECOND_OF_DAY\", \"SECOND_OF_MINUTE\", \"YEAR\", \"YEAR_OF_ERA\"]."
]
},
{
"query": "from a_index | eval var = date_extract(\"ALIGNED_DAY_OF_WEEK_IN_MONTH\", dateField)",
"error": [],
Expand All @@ -11024,7 +11031,6 @@
{
"query": "from a_index | eval date_extract(stringField, stringField)",
"error": [
"Argument of [date_extract] must be [chrono_literal], found value [stringField] type [string]",
"Argument of [date_extract] must be [date], found value [stringField] type [string]"
],
"warning": []
Expand All @@ -11044,7 +11050,7 @@
{
"query": "row var = date_extract(true, true)",
"error": [
"Argument of [date_extract] must be [chrono_literal], found value [true] type [boolean]",
"Argument of [date_extract] must be [string], found value [true] type [boolean]",
"Argument of [date_extract] must be [date], found value [true] type [boolean]"
],
"warning": []
Expand All @@ -11057,7 +11063,7 @@
{
"query": "from a_index | eval date_extract(booleanField, booleanField)",
"error": [
"Argument of [date_extract] must be [chrono_literal], found value [booleanField] type [boolean]",
"Argument of [date_extract] must be [string], found value [booleanField] type [boolean]",
"Argument of [date_extract] must be [date], found value [booleanField] type [boolean]"
],
"warning": []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2606,6 +2606,13 @@ describe('validation logic', () => {
describe('date_extract', () => {
testErrorsAndWarnings('row var = date_extract("ALIGNED_DAY_OF_WEEK_IN_MONTH", now())', []);
testErrorsAndWarnings('row date_extract("ALIGNED_DAY_OF_WEEK_IN_MONTH", now())', []);
testErrorsAndWarnings(
'from a_index | eval date_extract("SOME_RANDOM_STRING", now())',
[],
[
'Invalid option ["SOME_RANDOM_STRING"] for date_extract. Supported options: ["ALIGNED_DAY_OF_WEEK_IN_MONTH", "ALIGNED_DAY_OF_WEEK_IN_YEAR", "ALIGNED_WEEK_OF_MONTH", "ALIGNED_WEEK_OF_YEAR", "AMPM_OF_DAY", "CLOCK_HOUR_OF_AMPM", "CLOCK_HOUR_OF_DAY", "DAY_OF_MONTH", "DAY_OF_WEEK", "DAY_OF_YEAR", "EPOCH_DAY", "ERA", "HOUR_OF_AMPM", "HOUR_OF_DAY", "INSTANT_SECONDS", "MICRO_OF_DAY", "MICRO_OF_SECOND", "MILLI_OF_DAY", "MILLI_OF_SECOND", "MINUTE_OF_DAY", "MINUTE_OF_HOUR", "MONTH_OF_YEAR", "NANO_OF_DAY", "NANO_OF_SECOND", "OFFSET_SECONDS", "PROLEPTIC_MONTH", "SECOND_OF_DAY", "SECOND_OF_MINUTE", "YEAR", "YEAR_OF_ERA"].',
]
);

testErrorsAndWarnings(
'from a_index | eval var = date_extract("ALIGNED_DAY_OF_WEEK_IN_MONTH", dateField)',
Expand All @@ -2623,7 +2630,6 @@ describe('validation logic', () => {
);

testErrorsAndWarnings('from a_index | eval date_extract(stringField, stringField)', [
'Argument of [date_extract] must be [chrono_literal], found value [stringField] type [string]',
'Argument of [date_extract] must be [date], found value [stringField] type [string]',
]);

Expand All @@ -2638,7 +2644,7 @@ describe('validation logic', () => {
);

testErrorsAndWarnings('row var = date_extract(true, true)', [
'Argument of [date_extract] must be [chrono_literal], found value [true] type [boolean]',
'Argument of [date_extract] must be [string], found value [true] type [boolean]',
'Argument of [date_extract] must be [date], found value [true] type [boolean]',
]);

Expand All @@ -2648,7 +2654,7 @@ describe('validation logic', () => {
);

testErrorsAndWarnings('from a_index | eval date_extract(booleanField, booleanField)', [
'Argument of [date_extract] must be [chrono_literal], found value [booleanField] type [boolean]',
'Argument of [date_extract] must be [string], found value [booleanField] type [boolean]',
'Argument of [date_extract] must be [date], found value [booleanField] type [boolean]',
]);
testErrorsAndWarnings('from a_index | eval date_extract(null, null)', []);
Expand Down

0 comments on commit 7b5c359

Please sign in to comment.