n8n/packages/workflow/test/ExpressionExtensions/DateExtensions.test.ts

102 lines
3.9 KiB
TypeScript
Raw Normal View History

feat: Expression extension framework (#4372) * :zap: Introduce a framework for expression extension * :bulb: Add some inline comments * :zap: Introduce hash alias for encrypt * :zap: Introduce a manual granular level approach to shadowing/overrideing extensions * :fire: Cleanup comments * :zap: Introduce a basic method of extension for native functions * :zap: Add length to StringExtension * :zap: Add number type to extension return types * :zap: Temporarily introduce DateTime with extension * :zap: Cleanup comments * :zap: Organize imports * :recycle: Fix up some typings * :zap: Fix typings * :recycle: Remove unnecessary resolve of expression * :zap: Extensions Improvement * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Update extraArgs types * :recycle: Fix tests * :recycle: Fix bind type issue * :recycle: Fixing duration type issue * :recycle: Refactor to allow overrides on native methods * :recycle: Temporarily remove Date Extensions to pass tests * feat(dt-functions): introduce date expression extensions (#4045) * :tada: Add Date Extensions into the mix * :sparkles: Introduce additional date extension methods * :white_check_mark: Add Date Expression Extension tests * :wrench: Add ability to debug tests * :recycle: Refactor extension for native types * :fire: Move sayHi method to String Extension class * :recycle: Update scope when binding member methods * :white_check_mark: Add String Extension tests * feat(dt-functions): introduce array expression extensions (#4044) * :sparkles: Introduce Array Extensions * :white_check_mark: Add Array Expression tests * feat(dt-functions): introduce number expression extensions (#4046) * :tada: Introduce Number Extensions * :zap: Support more shared extensions * :zap: Improve handling of name collision * :white_check_mark: Update tests * Fixed up tests * :fire: Remove remove markdown * :recylce: Replace remove-markdown dependencies with implementation * :recycle: Replace remove-markdown dependencies with implementation * :white_check_mark: Update tests * :recycle: Fix scoping and cleanup * :recycle: Update comments and errors * :recycle: Fix linting errors * :heavy_minus_sign: Remove unused dependencies * fix: expression extension not working with multiple extensions * refactor: change extension transform to be more efficient * test: update most test to work with new extend function * fix: update and fix type error in config * refactor: replace babel with recast * feat: add hashing functions to string extension * fix: removed export * test: add extension parser and transform tests * fix: vite tests breaking * refactor: remove commented out code * fix: parse dates passed from $json in extend function * refactor: review feedback changes for date extensions * refactor: review feedback changes for number extensions * fix: date extension beginningOf test * fix: broken build from merge * fix: another merge issue * refactor: address review feedback (remove ignores) * feat: new extension functions and tests * feat: non-dot notation functions * test: most of the other tests * fix: toSentenceCase for node versions below 16.6 * feat: add $if and $not expression extensions * Fix test to work on every timezone * lint: fix remaining lint issues Co-authored-by: Csaba Tuncsik <csaba@n8n.io> Co-authored-by: Omar Ajoue <krynble@gmail.com>
2023-01-10 05:06:12 -08:00
/**
* @jest-environment jsdom
*/
import { DateTime } from 'luxon';
import { evaluate, getLocalISOString, TEST_TIMEZONE } from './Helpers';
feat: Expression extension framework (#4372) * :zap: Introduce a framework for expression extension * :bulb: Add some inline comments * :zap: Introduce hash alias for encrypt * :zap: Introduce a manual granular level approach to shadowing/overrideing extensions * :fire: Cleanup comments * :zap: Introduce a basic method of extension for native functions * :zap: Add length to StringExtension * :zap: Add number type to extension return types * :zap: Temporarily introduce DateTime with extension * :zap: Cleanup comments * :zap: Organize imports * :recycle: Fix up some typings * :zap: Fix typings * :recycle: Remove unnecessary resolve of expression * :zap: Extensions Improvement * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Update extraArgs types * :recycle: Fix tests * :recycle: Fix bind type issue * :recycle: Fixing duration type issue * :recycle: Refactor to allow overrides on native methods * :recycle: Temporarily remove Date Extensions to pass tests * feat(dt-functions): introduce date expression extensions (#4045) * :tada: Add Date Extensions into the mix * :sparkles: Introduce additional date extension methods * :white_check_mark: Add Date Expression Extension tests * :wrench: Add ability to debug tests * :recycle: Refactor extension for native types * :fire: Move sayHi method to String Extension class * :recycle: Update scope when binding member methods * :white_check_mark: Add String Extension tests * feat(dt-functions): introduce array expression extensions (#4044) * :sparkles: Introduce Array Extensions * :white_check_mark: Add Array Expression tests * feat(dt-functions): introduce number expression extensions (#4046) * :tada: Introduce Number Extensions * :zap: Support more shared extensions * :zap: Improve handling of name collision * :white_check_mark: Update tests * Fixed up tests * :fire: Remove remove markdown * :recylce: Replace remove-markdown dependencies with implementation * :recycle: Replace remove-markdown dependencies with implementation * :white_check_mark: Update tests * :recycle: Fix scoping and cleanup * :recycle: Update comments and errors * :recycle: Fix linting errors * :heavy_minus_sign: Remove unused dependencies * fix: expression extension not working with multiple extensions * refactor: change extension transform to be more efficient * test: update most test to work with new extend function * fix: update and fix type error in config * refactor: replace babel with recast * feat: add hashing functions to string extension * fix: removed export * test: add extension parser and transform tests * fix: vite tests breaking * refactor: remove commented out code * fix: parse dates passed from $json in extend function * refactor: review feedback changes for date extensions * refactor: review feedback changes for number extensions * fix: date extension beginningOf test * fix: broken build from merge * fix: another merge issue * refactor: address review feedback (remove ignores) * feat: new extension functions and tests * feat: non-dot notation functions * test: most of the other tests * fix: toSentenceCase for node versions below 16.6 * feat: add $if and $not expression extensions * Fix test to work on every timezone * lint: fix remaining lint issues Co-authored-by: Csaba Tuncsik <csaba@n8n.io> Co-authored-by: Omar Ajoue <krynble@gmail.com>
2023-01-10 05:06:12 -08:00
describe('Data Transformation Functions', () => {
describe('Date Data Transformation Functions', () => {
test('.isWeekend() should work correctly on a date', () => {
expect(evaluate('={{ DateTime.local(2023, 1, 20).isWeekend() }}')).toBe(false);
expect(evaluate('={{ DateTime.local(2023, 1, 21).isWeekend() }}')).toBe(true);
expect(evaluate('={{ DateTime.local(2023, 1, 22).isWeekend() }}')).toBe(true);
expect(evaluate('={{ DateTime.local(2023, 1, 23).isWeekend() }}')).toBe(false);
feat: Expression extension framework (#4372) * :zap: Introduce a framework for expression extension * :bulb: Add some inline comments * :zap: Introduce hash alias for encrypt * :zap: Introduce a manual granular level approach to shadowing/overrideing extensions * :fire: Cleanup comments * :zap: Introduce a basic method of extension for native functions * :zap: Add length to StringExtension * :zap: Add number type to extension return types * :zap: Temporarily introduce DateTime with extension * :zap: Cleanup comments * :zap: Organize imports * :recycle: Fix up some typings * :zap: Fix typings * :recycle: Remove unnecessary resolve of expression * :zap: Extensions Improvement * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Update extraArgs types * :recycle: Fix tests * :recycle: Fix bind type issue * :recycle: Fixing duration type issue * :recycle: Refactor to allow overrides on native methods * :recycle: Temporarily remove Date Extensions to pass tests * feat(dt-functions): introduce date expression extensions (#4045) * :tada: Add Date Extensions into the mix * :sparkles: Introduce additional date extension methods * :white_check_mark: Add Date Expression Extension tests * :wrench: Add ability to debug tests * :recycle: Refactor extension for native types * :fire: Move sayHi method to String Extension class * :recycle: Update scope when binding member methods * :white_check_mark: Add String Extension tests * feat(dt-functions): introduce array expression extensions (#4044) * :sparkles: Introduce Array Extensions * :white_check_mark: Add Array Expression tests * feat(dt-functions): introduce number expression extensions (#4046) * :tada: Introduce Number Extensions * :zap: Support more shared extensions * :zap: Improve handling of name collision * :white_check_mark: Update tests * Fixed up tests * :fire: Remove remove markdown * :recylce: Replace remove-markdown dependencies with implementation * :recycle: Replace remove-markdown dependencies with implementation * :white_check_mark: Update tests * :recycle: Fix scoping and cleanup * :recycle: Update comments and errors * :recycle: Fix linting errors * :heavy_minus_sign: Remove unused dependencies * fix: expression extension not working with multiple extensions * refactor: change extension transform to be more efficient * test: update most test to work with new extend function * fix: update and fix type error in config * refactor: replace babel with recast * feat: add hashing functions to string extension * fix: removed export * test: add extension parser and transform tests * fix: vite tests breaking * refactor: remove commented out code * fix: parse dates passed from $json in extend function * refactor: review feedback changes for date extensions * refactor: review feedback changes for number extensions * fix: date extension beginningOf test * fix: broken build from merge * fix: another merge issue * refactor: address review feedback (remove ignores) * feat: new extension functions and tests * feat: non-dot notation functions * test: most of the other tests * fix: toSentenceCase for node versions below 16.6 * feat: add $if and $not expression extensions * Fix test to work on every timezone * lint: fix remaining lint issues Co-authored-by: Csaba Tuncsik <csaba@n8n.io> Co-authored-by: Omar Ajoue <krynble@gmail.com>
2023-01-10 05:06:12 -08:00
});
test('.beginningOf("week") should work correctly on a date', () => {
expect(evaluate('={{ DateTime.local(2023, 1, 20).beginningOf("week") }}')).toEqual(
DateTime.local(2023, 1, 16, { zone: TEST_TIMEZONE }).toJSDate(),
feat: Expression extension framework (#4372) * :zap: Introduce a framework for expression extension * :bulb: Add some inline comments * :zap: Introduce hash alias for encrypt * :zap: Introduce a manual granular level approach to shadowing/overrideing extensions * :fire: Cleanup comments * :zap: Introduce a basic method of extension for native functions * :zap: Add length to StringExtension * :zap: Add number type to extension return types * :zap: Temporarily introduce DateTime with extension * :zap: Cleanup comments * :zap: Organize imports * :recycle: Fix up some typings * :zap: Fix typings * :recycle: Remove unnecessary resolve of expression * :zap: Extensions Improvement * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Update extraArgs types * :recycle: Fix tests * :recycle: Fix bind type issue * :recycle: Fixing duration type issue * :recycle: Refactor to allow overrides on native methods * :recycle: Temporarily remove Date Extensions to pass tests * feat(dt-functions): introduce date expression extensions (#4045) * :tada: Add Date Extensions into the mix * :sparkles: Introduce additional date extension methods * :white_check_mark: Add Date Expression Extension tests * :wrench: Add ability to debug tests * :recycle: Refactor extension for native types * :fire: Move sayHi method to String Extension class * :recycle: Update scope when binding member methods * :white_check_mark: Add String Extension tests * feat(dt-functions): introduce array expression extensions (#4044) * :sparkles: Introduce Array Extensions * :white_check_mark: Add Array Expression tests * feat(dt-functions): introduce number expression extensions (#4046) * :tada: Introduce Number Extensions * :zap: Support more shared extensions * :zap: Improve handling of name collision * :white_check_mark: Update tests * Fixed up tests * :fire: Remove remove markdown * :recylce: Replace remove-markdown dependencies with implementation * :recycle: Replace remove-markdown dependencies with implementation * :white_check_mark: Update tests * :recycle: Fix scoping and cleanup * :recycle: Update comments and errors * :recycle: Fix linting errors * :heavy_minus_sign: Remove unused dependencies * fix: expression extension not working with multiple extensions * refactor: change extension transform to be more efficient * test: update most test to work with new extend function * fix: update and fix type error in config * refactor: replace babel with recast * feat: add hashing functions to string extension * fix: removed export * test: add extension parser and transform tests * fix: vite tests breaking * refactor: remove commented out code * fix: parse dates passed from $json in extend function * refactor: review feedback changes for date extensions * refactor: review feedback changes for number extensions * fix: date extension beginningOf test * fix: broken build from merge * fix: another merge issue * refactor: address review feedback (remove ignores) * feat: new extension functions and tests * feat: non-dot notation functions * test: most of the other tests * fix: toSentenceCase for node versions below 16.6 * feat: add $if and $not expression extensions * Fix test to work on every timezone * lint: fix remaining lint issues Co-authored-by: Csaba Tuncsik <csaba@n8n.io> Co-authored-by: Omar Ajoue <krynble@gmail.com>
2023-01-10 05:06:12 -08:00
);
});
fix(core): Fix data transformation function that are reported not to work properly (#5338) * :fire: Remove test extensions * :construction: Add test description * :blue_book: Expand types * :zap: Export extensions * :zap: Export collection * :zap: Mark all proxies * :pencil2: Rename for clarity * :zap: Export from barrel * :sparkles: Create datatype completions * :zap: Mount datatype completions * :test_tube: Adjust tests * :zap: Add `path` prop * :fire: Remove `()` from completion labels * :zap: Filter out completions for pseudo-proxies * :bug: Fix method error * :zap: Add metrics * :pencil2: Improve naming * :sparkles: Start completion on empty resolvable * :sparkles: Implement completion previews * :zap: Break out completion manager * :zap: Implement in expression editor modal * :pencil2: Improve naming * :zap: Filter out irrelevant completions * :sparkles: Add preview hint * :pencil2: Improve comments * :art: Style preview hint * :zap: Expand `hasNoParams` * :zap: Add spacing for readability * :zap: Add error codes * :pencil2: Add comment * :bug: Fix Esc behavior * :zap: Parse Unicode * :zap: Throw on invalid `DateTime` * :zap: Fix second root completion detection * :zap: Switch message at completable prefix position * :bug: Fix function names for non-dev build * :bug: Fix `json` handling * :fire: Comment out previews * :recycle: Apply feedback * :fire: Remove extensions * :truck: Rename extensions * :zap: Adjust some implementations * :fire: Remove dummy extensions * :bug: Fix object regex * :recycle: Apply feedback * :pencil2: Fix typos * :pencil2: Add `fn is not a function` message * :fire: Remove check * :sparkles: Add `isNotEmpty` for objects * :truck: Rename `global` to `alpha` * :fire: Remove `encrypt` * :zap: Restore `is not a function` error * :zap: Support `week` on `extract()` * :test_tube: Fix tests * :zap: Add validation to some string extensions * :zap: Validate number arrays in some extensions * :test_tube: Fix tests * :pencil2: Improve error message * :rewind: Revert extensions framework changes * :broom: Previews cleanup * :zap: Condense blank completions * :zap: Refactor dollar completions * :zap: Refactor non-dollar completions * :zap: Refactor Luxon completions * :zap: Refactor datatype completions * :zap: Use `DATETIMEUNIT_MAP` * :pencil2: Update test description * :rewind: Revert "Use `DATETIMEUNIT_MAP`" This reverts commit 472a77df5cd789905d162f3c3db02ac767b89b4e. * :test_tube: Add tests * :recycle: Restore generic extensions * :fire: Remove logs * :test_tube: Expand tests * :sparkles: Add `Math` completions * :pencil2: List breaking change * :zap: Add doc tooltips * :bug: Fix node selector regex * :bug: Fix `context` resolution * :bug: Allow dollar completions in args * :zap: Make numeric array methods context-dependent * :pencil: Adjust docs * :bug: Fix selector ref * :zap: Surface error for valid URL * :bug: Disallow whitespace in `isEmail` check * :test_tube: Fix test for `isUrl` * :zap: Add comma validator in `toFloat` * :zap: Add validation to `$jmespath()` * :rewind: Revert valid URL error * :zap: Adjust `$jmespath()` validation * :test_tube: Adjust `isUrl` test * :zap: Remove `{}` and `[]` from compact * :pencil2: Update docs * :truck: Rename `stripTags` to `removeTags` * :zap: Do not inject whitespace inside resolvable * :zap: Make completions aware of `()` * :pencil2: Add note * :zap: Update sorting * :zap: Hide active node name from node selector * :fire: Remove `length()` and its aliases * :zap: Validate non-zero for `chunk` * :pencil2: Reword all error messages * :bug: Fix `$now` and `$today` * :zap: Simplify with `stripExcessParens` * :zap: Fold luxon into datatype * :test_tube: Clean up tests * :fire: Remove tests for removed methods * :shirt: Fix type * :arrow_up: Upgrade lang pack * :rewind: Undo change to `vitest` command * :fire: Remove unused method * :zap: Separate `return` line * :pencil2: Improve description * :test_tube: Expand tests for initial-only completions * :test_tube: Add bracket-aware completions * :zap: Make check for `all()` stricter * :pencil2: Adjust explanatory comments * :fire: Remove unneded copy * :fire: Remove outdated comment * :zap: Make naming consistent * :pencil2: Update comments * :zap: Improve URL scheme check * :pencil2: Add comment * :truck: Move extension * :pencil2: Update `BREAKING-CHANGES.md` * :pencil2: Update upcoming version * :pencil2: Fix grammar * :pencil2: Shorten message * :bug: Fix `Esc` behavior * :bug: Fix `isNumeric` * ✨ Using UTC to handle-dates on back-end * ✅ Added more unit tests for date extensions * ⚡ Not using `JSON.stringify` to render dates * ⚡ Using `deep-equal` library instead of our `deepCompare` function * ✅ Adding more tests to array extensions * ⚡ Fixing `inBetween` extension function * ✅ Added tests for `.inBetween()` * ⚡ Updating `isEven` and `isOdd` to throw for floats * ⚡ Updating `Array.merge()` so it works without arguments * 🔀 Fixing leftover merge confilct * ⚡ Updating `removeFieldsContaining` and `keepFieldsContaining` to throw on empty strings * ⚡ Fixing `pluck()` so it returns only plucked values * ⬆️ Updating pnpm lockfile * 👕 Fixing lint errors * ⚡ Using workflow timezone to display dates * ✔️ Updating tests with workflow timezone * ⚡ Not using system timezone when creating Luxon dates * ⚡ Updating `merge()` and `pluck()` array functions * 🔀 Sync with `master`: Removing code that was preserved during merge * ⚡ Updating `.pluck()` to return full array if no arguments are passed * ⚡ Updating `keepFieldsContaining` and `merge` object functions * ⚡ Using week as default for `date.extract()` * ✅ Adding more test cases for DT functions * ⚡ Removing `Object.merge` extension function. Adding missing `deep-equal` dependency * ⚡ Handling `toDate` case when time component is not specified * ⚡ Using workflow's timezone to render dates in output panel, updated unit tests after removing `Object.merge` function * ⚡ Not parsing numbers as dates * 👕 Fixing lint errors * ⚡ Fixing a typo * ⚡ Making date detection more strict so only stringified dates are getting converted * 👌 Addressing PR feedback * 🔥 Removing leftover comment --------- Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-02-15 01:50:16 -08:00
test('.beginningOf("week") should work correctly on a string', () => {
const evaluatedDate = evaluate('={{ "2023-01-30".toDate().beginningOf("week") }}');
const expectedDate = DateTime.local(2023, 1, 23, { zone: TEST_TIMEZONE }).toJSDate();
if (evaluatedDate && evaluatedDate instanceof Date) {
expect(evaluatedDate.toDateString()).toEqual(expectedDate.toDateString());
}
});
test('.beginningOf("month") should work correctly on a string', () => {
const evaluatedDate = evaluate('={{ "2023-06-16".toDate().beginningOf("month") }}');
const expectedDate = DateTime.local(2023, 6, 1, { zone: TEST_TIMEZONE }).toJSDate();
if (evaluatedDate && evaluatedDate instanceof Date) {
expect(evaluatedDate.toDateString()).toEqual(expectedDate.toDateString());
}
});
test('.beginningOf("year") should work correctly on a string', () => {
const evaluatedDate = evaluate('={{ "2023-01-30".toDate().beginningOf("year") }}');
const expectedDate = DateTime.local(2023, 1, 1, { zone: TEST_TIMEZONE }).toJSDate();
if (evaluatedDate && evaluatedDate instanceof Date) {
expect(evaluatedDate.toDateString()).toEqual(expectedDate.toDateString());
}
});
feat: Expression extension framework (#4372) * :zap: Introduce a framework for expression extension * :bulb: Add some inline comments * :zap: Introduce hash alias for encrypt * :zap: Introduce a manual granular level approach to shadowing/overrideing extensions * :fire: Cleanup comments * :zap: Introduce a basic method of extension for native functions * :zap: Add length to StringExtension * :zap: Add number type to extension return types * :zap: Temporarily introduce DateTime with extension * :zap: Cleanup comments * :zap: Organize imports * :recycle: Fix up some typings * :zap: Fix typings * :recycle: Remove unnecessary resolve of expression * :zap: Extensions Improvement * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Update extraArgs types * :recycle: Fix tests * :recycle: Fix bind type issue * :recycle: Fixing duration type issue * :recycle: Refactor to allow overrides on native methods * :recycle: Temporarily remove Date Extensions to pass tests * feat(dt-functions): introduce date expression extensions (#4045) * :tada: Add Date Extensions into the mix * :sparkles: Introduce additional date extension methods * :white_check_mark: Add Date Expression Extension tests * :wrench: Add ability to debug tests * :recycle: Refactor extension for native types * :fire: Move sayHi method to String Extension class * :recycle: Update scope when binding member methods * :white_check_mark: Add String Extension tests * feat(dt-functions): introduce array expression extensions (#4044) * :sparkles: Introduce Array Extensions * :white_check_mark: Add Array Expression tests * feat(dt-functions): introduce number expression extensions (#4046) * :tada: Introduce Number Extensions * :zap: Support more shared extensions * :zap: Improve handling of name collision * :white_check_mark: Update tests * Fixed up tests * :fire: Remove remove markdown * :recylce: Replace remove-markdown dependencies with implementation * :recycle: Replace remove-markdown dependencies with implementation * :white_check_mark: Update tests * :recycle: Fix scoping and cleanup * :recycle: Update comments and errors * :recycle: Fix linting errors * :heavy_minus_sign: Remove unused dependencies * fix: expression extension not working with multiple extensions * refactor: change extension transform to be more efficient * test: update most test to work with new extend function * fix: update and fix type error in config * refactor: replace babel with recast * feat: add hashing functions to string extension * fix: removed export * test: add extension parser and transform tests * fix: vite tests breaking * refactor: remove commented out code * fix: parse dates passed from $json in extend function * refactor: review feedback changes for date extensions * refactor: review feedback changes for number extensions * fix: date extension beginningOf test * fix: broken build from merge * fix: another merge issue * refactor: address review feedback (remove ignores) * feat: new extension functions and tests * feat: non-dot notation functions * test: most of the other tests * fix: toSentenceCase for node versions below 16.6 * feat: add $if and $not expression extensions * Fix test to work on every timezone * lint: fix remaining lint issues Co-authored-by: Csaba Tuncsik <csaba@n8n.io> Co-authored-by: Omar Ajoue <krynble@gmail.com>
2023-01-10 05:06:12 -08:00
test('.endOfMonth() should work correctly on a date', () => {
expect(evaluate('={{ DateTime.local(2023, 1, 16).endOfMonth() }}')).toEqual(
DateTime.local(2023, 1, 31, 23, 59, 59, 999, { zone: TEST_TIMEZONE }).toJSDate(),
feat: Expression extension framework (#4372) * :zap: Introduce a framework for expression extension * :bulb: Add some inline comments * :zap: Introduce hash alias for encrypt * :zap: Introduce a manual granular level approach to shadowing/overrideing extensions * :fire: Cleanup comments * :zap: Introduce a basic method of extension for native functions * :zap: Add length to StringExtension * :zap: Add number type to extension return types * :zap: Temporarily introduce DateTime with extension * :zap: Cleanup comments * :zap: Organize imports * :recycle: Fix up some typings * :zap: Fix typings * :recycle: Remove unnecessary resolve of expression * :zap: Extensions Improvement * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Update extraArgs types * :recycle: Fix tests * :recycle: Fix bind type issue * :recycle: Fixing duration type issue * :recycle: Refactor to allow overrides on native methods * :recycle: Temporarily remove Date Extensions to pass tests * feat(dt-functions): introduce date expression extensions (#4045) * :tada: Add Date Extensions into the mix * :sparkles: Introduce additional date extension methods * :white_check_mark: Add Date Expression Extension tests * :wrench: Add ability to debug tests * :recycle: Refactor extension for native types * :fire: Move sayHi method to String Extension class * :recycle: Update scope when binding member methods * :white_check_mark: Add String Extension tests * feat(dt-functions): introduce array expression extensions (#4044) * :sparkles: Introduce Array Extensions * :white_check_mark: Add Array Expression tests * feat(dt-functions): introduce number expression extensions (#4046) * :tada: Introduce Number Extensions * :zap: Support more shared extensions * :zap: Improve handling of name collision * :white_check_mark: Update tests * Fixed up tests * :fire: Remove remove markdown * :recylce: Replace remove-markdown dependencies with implementation * :recycle: Replace remove-markdown dependencies with implementation * :white_check_mark: Update tests * :recycle: Fix scoping and cleanup * :recycle: Update comments and errors * :recycle: Fix linting errors * :heavy_minus_sign: Remove unused dependencies * fix: expression extension not working with multiple extensions * refactor: change extension transform to be more efficient * test: update most test to work with new extend function * fix: update and fix type error in config * refactor: replace babel with recast * feat: add hashing functions to string extension * fix: removed export * test: add extension parser and transform tests * fix: vite tests breaking * refactor: remove commented out code * fix: parse dates passed from $json in extend function * refactor: review feedback changes for date extensions * refactor: review feedback changes for number extensions * fix: date extension beginningOf test * fix: broken build from merge * fix: another merge issue * refactor: address review feedback (remove ignores) * feat: new extension functions and tests * feat: non-dot notation functions * test: most of the other tests * fix: toSentenceCase for node versions below 16.6 * feat: add $if and $not expression extensions * Fix test to work on every timezone * lint: fix remaining lint issues Co-authored-by: Csaba Tuncsik <csaba@n8n.io> Co-authored-by: Omar Ajoue <krynble@gmail.com>
2023-01-10 05:06:12 -08:00
);
});
test('.extract("day") should work correctly on a date', () => {
expect(evaluate('={{ DateTime.local(2023, 1, 20).extract("day") }}')).toEqual(20);
feat: Expression extension framework (#4372) * :zap: Introduce a framework for expression extension * :bulb: Add some inline comments * :zap: Introduce hash alias for encrypt * :zap: Introduce a manual granular level approach to shadowing/overrideing extensions * :fire: Cleanup comments * :zap: Introduce a basic method of extension for native functions * :zap: Add length to StringExtension * :zap: Add number type to extension return types * :zap: Temporarily introduce DateTime with extension * :zap: Cleanup comments * :zap: Organize imports * :recycle: Fix up some typings * :zap: Fix typings * :recycle: Remove unnecessary resolve of expression * :zap: Extensions Improvement * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Update extraArgs types * :recycle: Fix tests * :recycle: Fix bind type issue * :recycle: Fixing duration type issue * :recycle: Refactor to allow overrides on native methods * :recycle: Temporarily remove Date Extensions to pass tests * feat(dt-functions): introduce date expression extensions (#4045) * :tada: Add Date Extensions into the mix * :sparkles: Introduce additional date extension methods * :white_check_mark: Add Date Expression Extension tests * :wrench: Add ability to debug tests * :recycle: Refactor extension for native types * :fire: Move sayHi method to String Extension class * :recycle: Update scope when binding member methods * :white_check_mark: Add String Extension tests * feat(dt-functions): introduce array expression extensions (#4044) * :sparkles: Introduce Array Extensions * :white_check_mark: Add Array Expression tests * feat(dt-functions): introduce number expression extensions (#4046) * :tada: Introduce Number Extensions * :zap: Support more shared extensions * :zap: Improve handling of name collision * :white_check_mark: Update tests * Fixed up tests * :fire: Remove remove markdown * :recylce: Replace remove-markdown dependencies with implementation * :recycle: Replace remove-markdown dependencies with implementation * :white_check_mark: Update tests * :recycle: Fix scoping and cleanup * :recycle: Update comments and errors * :recycle: Fix linting errors * :heavy_minus_sign: Remove unused dependencies * fix: expression extension not working with multiple extensions * refactor: change extension transform to be more efficient * test: update most test to work with new extend function * fix: update and fix type error in config * refactor: replace babel with recast * feat: add hashing functions to string extension * fix: removed export * test: add extension parser and transform tests * fix: vite tests breaking * refactor: remove commented out code * fix: parse dates passed from $json in extend function * refactor: review feedback changes for date extensions * refactor: review feedback changes for number extensions * fix: date extension beginningOf test * fix: broken build from merge * fix: another merge issue * refactor: address review feedback (remove ignores) * feat: new extension functions and tests * feat: non-dot notation functions * test: most of the other tests * fix: toSentenceCase for node versions below 16.6 * feat: add $if and $not expression extensions * Fix test to work on every timezone * lint: fix remaining lint issues Co-authored-by: Csaba Tuncsik <csaba@n8n.io> Co-authored-by: Omar Ajoue <krynble@gmail.com>
2023-01-10 05:06:12 -08:00
});
fix(core): Fix data transformation function that are reported not to work properly (#5338) * :fire: Remove test extensions * :construction: Add test description * :blue_book: Expand types * :zap: Export extensions * :zap: Export collection * :zap: Mark all proxies * :pencil2: Rename for clarity * :zap: Export from barrel * :sparkles: Create datatype completions * :zap: Mount datatype completions * :test_tube: Adjust tests * :zap: Add `path` prop * :fire: Remove `()` from completion labels * :zap: Filter out completions for pseudo-proxies * :bug: Fix method error * :zap: Add metrics * :pencil2: Improve naming * :sparkles: Start completion on empty resolvable * :sparkles: Implement completion previews * :zap: Break out completion manager * :zap: Implement in expression editor modal * :pencil2: Improve naming * :zap: Filter out irrelevant completions * :sparkles: Add preview hint * :pencil2: Improve comments * :art: Style preview hint * :zap: Expand `hasNoParams` * :zap: Add spacing for readability * :zap: Add error codes * :pencil2: Add comment * :bug: Fix Esc behavior * :zap: Parse Unicode * :zap: Throw on invalid `DateTime` * :zap: Fix second root completion detection * :zap: Switch message at completable prefix position * :bug: Fix function names for non-dev build * :bug: Fix `json` handling * :fire: Comment out previews * :recycle: Apply feedback * :fire: Remove extensions * :truck: Rename extensions * :zap: Adjust some implementations * :fire: Remove dummy extensions * :bug: Fix object regex * :recycle: Apply feedback * :pencil2: Fix typos * :pencil2: Add `fn is not a function` message * :fire: Remove check * :sparkles: Add `isNotEmpty` for objects * :truck: Rename `global` to `alpha` * :fire: Remove `encrypt` * :zap: Restore `is not a function` error * :zap: Support `week` on `extract()` * :test_tube: Fix tests * :zap: Add validation to some string extensions * :zap: Validate number arrays in some extensions * :test_tube: Fix tests * :pencil2: Improve error message * :rewind: Revert extensions framework changes * :broom: Previews cleanup * :zap: Condense blank completions * :zap: Refactor dollar completions * :zap: Refactor non-dollar completions * :zap: Refactor Luxon completions * :zap: Refactor datatype completions * :zap: Use `DATETIMEUNIT_MAP` * :pencil2: Update test description * :rewind: Revert "Use `DATETIMEUNIT_MAP`" This reverts commit 472a77df5cd789905d162f3c3db02ac767b89b4e. * :test_tube: Add tests * :recycle: Restore generic extensions * :fire: Remove logs * :test_tube: Expand tests * :sparkles: Add `Math` completions * :pencil2: List breaking change * :zap: Add doc tooltips * :bug: Fix node selector regex * :bug: Fix `context` resolution * :bug: Allow dollar completions in args * :zap: Make numeric array methods context-dependent * :pencil: Adjust docs * :bug: Fix selector ref * :zap: Surface error for valid URL * :bug: Disallow whitespace in `isEmail` check * :test_tube: Fix test for `isUrl` * :zap: Add comma validator in `toFloat` * :zap: Add validation to `$jmespath()` * :rewind: Revert valid URL error * :zap: Adjust `$jmespath()` validation * :test_tube: Adjust `isUrl` test * :zap: Remove `{}` and `[]` from compact * :pencil2: Update docs * :truck: Rename `stripTags` to `removeTags` * :zap: Do not inject whitespace inside resolvable * :zap: Make completions aware of `()` * :pencil2: Add note * :zap: Update sorting * :zap: Hide active node name from node selector * :fire: Remove `length()` and its aliases * :zap: Validate non-zero for `chunk` * :pencil2: Reword all error messages * :bug: Fix `$now` and `$today` * :zap: Simplify with `stripExcessParens` * :zap: Fold luxon into datatype * :test_tube: Clean up tests * :fire: Remove tests for removed methods * :shirt: Fix type * :arrow_up: Upgrade lang pack * :rewind: Undo change to `vitest` command * :fire: Remove unused method * :zap: Separate `return` line * :pencil2: Improve description * :test_tube: Expand tests for initial-only completions * :test_tube: Add bracket-aware completions * :zap: Make check for `all()` stricter * :pencil2: Adjust explanatory comments * :fire: Remove unneded copy * :fire: Remove outdated comment * :zap: Make naming consistent * :pencil2: Update comments * :zap: Improve URL scheme check * :pencil2: Add comment * :truck: Move extension * :pencil2: Update `BREAKING-CHANGES.md` * :pencil2: Update upcoming version * :pencil2: Fix grammar * :pencil2: Shorten message * :bug: Fix `Esc` behavior * :bug: Fix `isNumeric` * ✨ Using UTC to handle-dates on back-end * ✅ Added more unit tests for date extensions * ⚡ Not using `JSON.stringify` to render dates * ⚡ Using `deep-equal` library instead of our `deepCompare` function * ✅ Adding more tests to array extensions * ⚡ Fixing `inBetween` extension function * ✅ Added tests for `.inBetween()` * ⚡ Updating `isEven` and `isOdd` to throw for floats * ⚡ Updating `Array.merge()` so it works without arguments * 🔀 Fixing leftover merge confilct * ⚡ Updating `removeFieldsContaining` and `keepFieldsContaining` to throw on empty strings * ⚡ Fixing `pluck()` so it returns only plucked values * ⬆️ Updating pnpm lockfile * 👕 Fixing lint errors * ⚡ Using workflow timezone to display dates * ✔️ Updating tests with workflow timezone * ⚡ Not using system timezone when creating Luxon dates * ⚡ Updating `merge()` and `pluck()` array functions * 🔀 Sync with `master`: Removing code that was preserved during merge * ⚡ Updating `.pluck()` to return full array if no arguments are passed * ⚡ Updating `keepFieldsContaining` and `merge` object functions * ⚡ Using week as default for `date.extract()` * ✅ Adding more test cases for DT functions * ⚡ Removing `Object.merge` extension function. Adding missing `deep-equal` dependency * ⚡ Handling `toDate` case when time component is not specified * ⚡ Using workflow's timezone to render dates in output panel, updated unit tests after removing `Object.merge` function * ⚡ Not parsing numbers as dates * 👕 Fixing lint errors * ⚡ Fixing a typo * ⚡ Making date detection more strict so only stringified dates are getting converted * 👌 Addressing PR feedback * 🔥 Removing leftover comment --------- Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-02-15 01:50:16 -08:00
test('.extract() should extract week for no args', () => {
expect(evaluate('={{ DateTime.local(2023, 1, 20).extract() }}')).toEqual(3);
});
feat: Expression extension framework (#4372) * :zap: Introduce a framework for expression extension * :bulb: Add some inline comments * :zap: Introduce hash alias for encrypt * :zap: Introduce a manual granular level approach to shadowing/overrideing extensions * :fire: Cleanup comments * :zap: Introduce a basic method of extension for native functions * :zap: Add length to StringExtension * :zap: Add number type to extension return types * :zap: Temporarily introduce DateTime with extension * :zap: Cleanup comments * :zap: Organize imports * :recycle: Fix up some typings * :zap: Fix typings * :recycle: Remove unnecessary resolve of expression * :zap: Extensions Improvement * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Update extraArgs types * :recycle: Fix tests * :recycle: Fix bind type issue * :recycle: Fixing duration type issue * :recycle: Refactor to allow overrides on native methods * :recycle: Temporarily remove Date Extensions to pass tests * feat(dt-functions): introduce date expression extensions (#4045) * :tada: Add Date Extensions into the mix * :sparkles: Introduce additional date extension methods * :white_check_mark: Add Date Expression Extension tests * :wrench: Add ability to debug tests * :recycle: Refactor extension for native types * :fire: Move sayHi method to String Extension class * :recycle: Update scope when binding member methods * :white_check_mark: Add String Extension tests * feat(dt-functions): introduce array expression extensions (#4044) * :sparkles: Introduce Array Extensions * :white_check_mark: Add Array Expression tests * feat(dt-functions): introduce number expression extensions (#4046) * :tada: Introduce Number Extensions * :zap: Support more shared extensions * :zap: Improve handling of name collision * :white_check_mark: Update tests * Fixed up tests * :fire: Remove remove markdown * :recylce: Replace remove-markdown dependencies with implementation * :recycle: Replace remove-markdown dependencies with implementation * :white_check_mark: Update tests * :recycle: Fix scoping and cleanup * :recycle: Update comments and errors * :recycle: Fix linting errors * :heavy_minus_sign: Remove unused dependencies * fix: expression extension not working with multiple extensions * refactor: change extension transform to be more efficient * test: update most test to work with new extend function * fix: update and fix type error in config * refactor: replace babel with recast * feat: add hashing functions to string extension * fix: removed export * test: add extension parser and transform tests * fix: vite tests breaking * refactor: remove commented out code * fix: parse dates passed from $json in extend function * refactor: review feedback changes for date extensions * refactor: review feedback changes for number extensions * fix: date extension beginningOf test * fix: broken build from merge * fix: another merge issue * refactor: address review feedback (remove ignores) * feat: new extension functions and tests * feat: non-dot notation functions * test: most of the other tests * fix: toSentenceCase for node versions below 16.6 * feat: add $if and $not expression extensions * Fix test to work on every timezone * lint: fix remaining lint issues Co-authored-by: Csaba Tuncsik <csaba@n8n.io> Co-authored-by: Omar Ajoue <krynble@gmail.com>
2023-01-10 05:06:12 -08:00
test('.format("yyyy LLL dd") should work correctly on a date', () => {
expect(evaluate('={{ DateTime.local(2023, 1, 16).format("yyyy LLL dd") }}')).toEqual(
'2023 Jan 16',
feat: Expression extension framework (#4372) * :zap: Introduce a framework for expression extension * :bulb: Add some inline comments * :zap: Introduce hash alias for encrypt * :zap: Introduce a manual granular level approach to shadowing/overrideing extensions * :fire: Cleanup comments * :zap: Introduce a basic method of extension for native functions * :zap: Add length to StringExtension * :zap: Add number type to extension return types * :zap: Temporarily introduce DateTime with extension * :zap: Cleanup comments * :zap: Organize imports * :recycle: Fix up some typings * :zap: Fix typings * :recycle: Remove unnecessary resolve of expression * :zap: Extensions Improvement * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Update extraArgs types * :recycle: Fix tests * :recycle: Fix bind type issue * :recycle: Fixing duration type issue * :recycle: Refactor to allow overrides on native methods * :recycle: Temporarily remove Date Extensions to pass tests * feat(dt-functions): introduce date expression extensions (#4045) * :tada: Add Date Extensions into the mix * :sparkles: Introduce additional date extension methods * :white_check_mark: Add Date Expression Extension tests * :wrench: Add ability to debug tests * :recycle: Refactor extension for native types * :fire: Move sayHi method to String Extension class * :recycle: Update scope when binding member methods * :white_check_mark: Add String Extension tests * feat(dt-functions): introduce array expression extensions (#4044) * :sparkles: Introduce Array Extensions * :white_check_mark: Add Array Expression tests * feat(dt-functions): introduce number expression extensions (#4046) * :tada: Introduce Number Extensions * :zap: Support more shared extensions * :zap: Improve handling of name collision * :white_check_mark: Update tests * Fixed up tests * :fire: Remove remove markdown * :recylce: Replace remove-markdown dependencies with implementation * :recycle: Replace remove-markdown dependencies with implementation * :white_check_mark: Update tests * :recycle: Fix scoping and cleanup * :recycle: Update comments and errors * :recycle: Fix linting errors * :heavy_minus_sign: Remove unused dependencies * fix: expression extension not working with multiple extensions * refactor: change extension transform to be more efficient * test: update most test to work with new extend function * fix: update and fix type error in config * refactor: replace babel with recast * feat: add hashing functions to string extension * fix: removed export * test: add extension parser and transform tests * fix: vite tests breaking * refactor: remove commented out code * fix: parse dates passed from $json in extend function * refactor: review feedback changes for date extensions * refactor: review feedback changes for number extensions * fix: date extension beginningOf test * fix: broken build from merge * fix: another merge issue * refactor: address review feedback (remove ignores) * feat: new extension functions and tests * feat: non-dot notation functions * test: most of the other tests * fix: toSentenceCase for node versions below 16.6 * feat: add $if and $not expression extensions * Fix test to work on every timezone * lint: fix remaining lint issues Co-authored-by: Csaba Tuncsik <csaba@n8n.io> Co-authored-by: Omar Ajoue <krynble@gmail.com>
2023-01-10 05:06:12 -08:00
);
});
test('.toDate() should work on a string', () => {
const date = new Date(2022, 0, 3);
expect(evaluate(`={{ "${getLocalISOString(date)}".toDate() }}`)).toEqual(date);
feat: Expression extension framework (#4372) * :zap: Introduce a framework for expression extension * :bulb: Add some inline comments * :zap: Introduce hash alias for encrypt * :zap: Introduce a manual granular level approach to shadowing/overrideing extensions * :fire: Cleanup comments * :zap: Introduce a basic method of extension for native functions * :zap: Add length to StringExtension * :zap: Add number type to extension return types * :zap: Temporarily introduce DateTime with extension * :zap: Cleanup comments * :zap: Organize imports * :recycle: Fix up some typings * :zap: Fix typings * :recycle: Remove unnecessary resolve of expression * :zap: Extensions Improvement * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Update extraArgs types * :recycle: Fix tests * :recycle: Fix bind type issue * :recycle: Fixing duration type issue * :recycle: Refactor to allow overrides on native methods * :recycle: Temporarily remove Date Extensions to pass tests * feat(dt-functions): introduce date expression extensions (#4045) * :tada: Add Date Extensions into the mix * :sparkles: Introduce additional date extension methods * :white_check_mark: Add Date Expression Extension tests * :wrench: Add ability to debug tests * :recycle: Refactor extension for native types * :fire: Move sayHi method to String Extension class * :recycle: Update scope when binding member methods * :white_check_mark: Add String Extension tests * feat(dt-functions): introduce array expression extensions (#4044) * :sparkles: Introduce Array Extensions * :white_check_mark: Add Array Expression tests * feat(dt-functions): introduce number expression extensions (#4046) * :tada: Introduce Number Extensions * :zap: Support more shared extensions * :zap: Improve handling of name collision * :white_check_mark: Update tests * Fixed up tests * :fire: Remove remove markdown * :recylce: Replace remove-markdown dependencies with implementation * :recycle: Replace remove-markdown dependencies with implementation * :white_check_mark: Update tests * :recycle: Fix scoping and cleanup * :recycle: Update comments and errors * :recycle: Fix linting errors * :heavy_minus_sign: Remove unused dependencies * fix: expression extension not working with multiple extensions * refactor: change extension transform to be more efficient * test: update most test to work with new extend function * fix: update and fix type error in config * refactor: replace babel with recast * feat: add hashing functions to string extension * fix: removed export * test: add extension parser and transform tests * fix: vite tests breaking * refactor: remove commented out code * fix: parse dates passed from $json in extend function * refactor: review feedback changes for date extensions * refactor: review feedback changes for number extensions * fix: date extension beginningOf test * fix: broken build from merge * fix: another merge issue * refactor: address review feedback (remove ignores) * feat: new extension functions and tests * feat: non-dot notation functions * test: most of the other tests * fix: toSentenceCase for node versions below 16.6 * feat: add $if and $not expression extensions * Fix test to work on every timezone * lint: fix remaining lint issues Co-authored-by: Csaba Tuncsik <csaba@n8n.io> Co-authored-by: Omar Ajoue <krynble@gmail.com>
2023-01-10 05:06:12 -08:00
});
fix(core): Fix data transformation function that are reported not to work properly (#5338) * :fire: Remove test extensions * :construction: Add test description * :blue_book: Expand types * :zap: Export extensions * :zap: Export collection * :zap: Mark all proxies * :pencil2: Rename for clarity * :zap: Export from barrel * :sparkles: Create datatype completions * :zap: Mount datatype completions * :test_tube: Adjust tests * :zap: Add `path` prop * :fire: Remove `()` from completion labels * :zap: Filter out completions for pseudo-proxies * :bug: Fix method error * :zap: Add metrics * :pencil2: Improve naming * :sparkles: Start completion on empty resolvable * :sparkles: Implement completion previews * :zap: Break out completion manager * :zap: Implement in expression editor modal * :pencil2: Improve naming * :zap: Filter out irrelevant completions * :sparkles: Add preview hint * :pencil2: Improve comments * :art: Style preview hint * :zap: Expand `hasNoParams` * :zap: Add spacing for readability * :zap: Add error codes * :pencil2: Add comment * :bug: Fix Esc behavior * :zap: Parse Unicode * :zap: Throw on invalid `DateTime` * :zap: Fix second root completion detection * :zap: Switch message at completable prefix position * :bug: Fix function names for non-dev build * :bug: Fix `json` handling * :fire: Comment out previews * :recycle: Apply feedback * :fire: Remove extensions * :truck: Rename extensions * :zap: Adjust some implementations * :fire: Remove dummy extensions * :bug: Fix object regex * :recycle: Apply feedback * :pencil2: Fix typos * :pencil2: Add `fn is not a function` message * :fire: Remove check * :sparkles: Add `isNotEmpty` for objects * :truck: Rename `global` to `alpha` * :fire: Remove `encrypt` * :zap: Restore `is not a function` error * :zap: Support `week` on `extract()` * :test_tube: Fix tests * :zap: Add validation to some string extensions * :zap: Validate number arrays in some extensions * :test_tube: Fix tests * :pencil2: Improve error message * :rewind: Revert extensions framework changes * :broom: Previews cleanup * :zap: Condense blank completions * :zap: Refactor dollar completions * :zap: Refactor non-dollar completions * :zap: Refactor Luxon completions * :zap: Refactor datatype completions * :zap: Use `DATETIMEUNIT_MAP` * :pencil2: Update test description * :rewind: Revert "Use `DATETIMEUNIT_MAP`" This reverts commit 472a77df5cd789905d162f3c3db02ac767b89b4e. * :test_tube: Add tests * :recycle: Restore generic extensions * :fire: Remove logs * :test_tube: Expand tests * :sparkles: Add `Math` completions * :pencil2: List breaking change * :zap: Add doc tooltips * :bug: Fix node selector regex * :bug: Fix `context` resolution * :bug: Allow dollar completions in args * :zap: Make numeric array methods context-dependent * :pencil: Adjust docs * :bug: Fix selector ref * :zap: Surface error for valid URL * :bug: Disallow whitespace in `isEmail` check * :test_tube: Fix test for `isUrl` * :zap: Add comma validator in `toFloat` * :zap: Add validation to `$jmespath()` * :rewind: Revert valid URL error * :zap: Adjust `$jmespath()` validation * :test_tube: Adjust `isUrl` test * :zap: Remove `{}` and `[]` from compact * :pencil2: Update docs * :truck: Rename `stripTags` to `removeTags` * :zap: Do not inject whitespace inside resolvable * :zap: Make completions aware of `()` * :pencil2: Add note * :zap: Update sorting * :zap: Hide active node name from node selector * :fire: Remove `length()` and its aliases * :zap: Validate non-zero for `chunk` * :pencil2: Reword all error messages * :bug: Fix `$now` and `$today` * :zap: Simplify with `stripExcessParens` * :zap: Fold luxon into datatype * :test_tube: Clean up tests * :fire: Remove tests for removed methods * :shirt: Fix type * :arrow_up: Upgrade lang pack * :rewind: Undo change to `vitest` command * :fire: Remove unused method * :zap: Separate `return` line * :pencil2: Improve description * :test_tube: Expand tests for initial-only completions * :test_tube: Add bracket-aware completions * :zap: Make check for `all()` stricter * :pencil2: Adjust explanatory comments * :fire: Remove unneded copy * :fire: Remove outdated comment * :zap: Make naming consistent * :pencil2: Update comments * :zap: Improve URL scheme check * :pencil2: Add comment * :truck: Move extension * :pencil2: Update `BREAKING-CHANGES.md` * :pencil2: Update upcoming version * :pencil2: Fix grammar * :pencil2: Shorten message * :bug: Fix `Esc` behavior * :bug: Fix `isNumeric` * ✨ Using UTC to handle-dates on back-end * ✅ Added more unit tests for date extensions * ⚡ Not using `JSON.stringify` to render dates * ⚡ Using `deep-equal` library instead of our `deepCompare` function * ✅ Adding more tests to array extensions * ⚡ Fixing `inBetween` extension function * ✅ Added tests for `.inBetween()` * ⚡ Updating `isEven` and `isOdd` to throw for floats * ⚡ Updating `Array.merge()` so it works without arguments * 🔀 Fixing leftover merge confilct * ⚡ Updating `removeFieldsContaining` and `keepFieldsContaining` to throw on empty strings * ⚡ Fixing `pluck()` so it returns only plucked values * ⬆️ Updating pnpm lockfile * 👕 Fixing lint errors * ⚡ Using workflow timezone to display dates * ✔️ Updating tests with workflow timezone * ⚡ Not using system timezone when creating Luxon dates * ⚡ Updating `merge()` and `pluck()` array functions * 🔀 Sync with `master`: Removing code that was preserved during merge * ⚡ Updating `.pluck()` to return full array if no arguments are passed * ⚡ Updating `keepFieldsContaining` and `merge` object functions * ⚡ Using week as default for `date.extract()` * ✅ Adding more test cases for DT functions * ⚡ Removing `Object.merge` extension function. Adding missing `deep-equal` dependency * ⚡ Handling `toDate` case when time component is not specified * ⚡ Using workflow's timezone to render dates in output panel, updated unit tests after removing `Object.merge` function * ⚡ Not parsing numbers as dates * 👕 Fixing lint errors * ⚡ Fixing a typo * ⚡ Making date detection more strict so only stringified dates are getting converted * 👌 Addressing PR feedback * 🔥 Removing leftover comment --------- Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-02-15 01:50:16 -08:00
test('.inBetween() should work on string and Date', () => {
expect(evaluate("={{ $now.isBetween('2023-06-23'.toDate(), '2023-06-23') }}")).toBeDefined();
fix(core): Fix data transformation function that are reported not to work properly (#5338) * :fire: Remove test extensions * :construction: Add test description * :blue_book: Expand types * :zap: Export extensions * :zap: Export collection * :zap: Mark all proxies * :pencil2: Rename for clarity * :zap: Export from barrel * :sparkles: Create datatype completions * :zap: Mount datatype completions * :test_tube: Adjust tests * :zap: Add `path` prop * :fire: Remove `()` from completion labels * :zap: Filter out completions for pseudo-proxies * :bug: Fix method error * :zap: Add metrics * :pencil2: Improve naming * :sparkles: Start completion on empty resolvable * :sparkles: Implement completion previews * :zap: Break out completion manager * :zap: Implement in expression editor modal * :pencil2: Improve naming * :zap: Filter out irrelevant completions * :sparkles: Add preview hint * :pencil2: Improve comments * :art: Style preview hint * :zap: Expand `hasNoParams` * :zap: Add spacing for readability * :zap: Add error codes * :pencil2: Add comment * :bug: Fix Esc behavior * :zap: Parse Unicode * :zap: Throw on invalid `DateTime` * :zap: Fix second root completion detection * :zap: Switch message at completable prefix position * :bug: Fix function names for non-dev build * :bug: Fix `json` handling * :fire: Comment out previews * :recycle: Apply feedback * :fire: Remove extensions * :truck: Rename extensions * :zap: Adjust some implementations * :fire: Remove dummy extensions * :bug: Fix object regex * :recycle: Apply feedback * :pencil2: Fix typos * :pencil2: Add `fn is not a function` message * :fire: Remove check * :sparkles: Add `isNotEmpty` for objects * :truck: Rename `global` to `alpha` * :fire: Remove `encrypt` * :zap: Restore `is not a function` error * :zap: Support `week` on `extract()` * :test_tube: Fix tests * :zap: Add validation to some string extensions * :zap: Validate number arrays in some extensions * :test_tube: Fix tests * :pencil2: Improve error message * :rewind: Revert extensions framework changes * :broom: Previews cleanup * :zap: Condense blank completions * :zap: Refactor dollar completions * :zap: Refactor non-dollar completions * :zap: Refactor Luxon completions * :zap: Refactor datatype completions * :zap: Use `DATETIMEUNIT_MAP` * :pencil2: Update test description * :rewind: Revert "Use `DATETIMEUNIT_MAP`" This reverts commit 472a77df5cd789905d162f3c3db02ac767b89b4e. * :test_tube: Add tests * :recycle: Restore generic extensions * :fire: Remove logs * :test_tube: Expand tests * :sparkles: Add `Math` completions * :pencil2: List breaking change * :zap: Add doc tooltips * :bug: Fix node selector regex * :bug: Fix `context` resolution * :bug: Allow dollar completions in args * :zap: Make numeric array methods context-dependent * :pencil: Adjust docs * :bug: Fix selector ref * :zap: Surface error for valid URL * :bug: Disallow whitespace in `isEmail` check * :test_tube: Fix test for `isUrl` * :zap: Add comma validator in `toFloat` * :zap: Add validation to `$jmespath()` * :rewind: Revert valid URL error * :zap: Adjust `$jmespath()` validation * :test_tube: Adjust `isUrl` test * :zap: Remove `{}` and `[]` from compact * :pencil2: Update docs * :truck: Rename `stripTags` to `removeTags` * :zap: Do not inject whitespace inside resolvable * :zap: Make completions aware of `()` * :pencil2: Add note * :zap: Update sorting * :zap: Hide active node name from node selector * :fire: Remove `length()` and its aliases * :zap: Validate non-zero for `chunk` * :pencil2: Reword all error messages * :bug: Fix `$now` and `$today` * :zap: Simplify with `stripExcessParens` * :zap: Fold luxon into datatype * :test_tube: Clean up tests * :fire: Remove tests for removed methods * :shirt: Fix type * :arrow_up: Upgrade lang pack * :rewind: Undo change to `vitest` command * :fire: Remove unused method * :zap: Separate `return` line * :pencil2: Improve description * :test_tube: Expand tests for initial-only completions * :test_tube: Add bracket-aware completions * :zap: Make check for `all()` stricter * :pencil2: Adjust explanatory comments * :fire: Remove unneded copy * :fire: Remove outdated comment * :zap: Make naming consistent * :pencil2: Update comments * :zap: Improve URL scheme check * :pencil2: Add comment * :truck: Move extension * :pencil2: Update `BREAKING-CHANGES.md` * :pencil2: Update upcoming version * :pencil2: Fix grammar * :pencil2: Shorten message * :bug: Fix `Esc` behavior * :bug: Fix `isNumeric` * ✨ Using UTC to handle-dates on back-end * ✅ Added more unit tests for date extensions * ⚡ Not using `JSON.stringify` to render dates * ⚡ Using `deep-equal` library instead of our `deepCompare` function * ✅ Adding more tests to array extensions * ⚡ Fixing `inBetween` extension function * ✅ Added tests for `.inBetween()` * ⚡ Updating `isEven` and `isOdd` to throw for floats * ⚡ Updating `Array.merge()` so it works without arguments * 🔀 Fixing leftover merge confilct * ⚡ Updating `removeFieldsContaining` and `keepFieldsContaining` to throw on empty strings * ⚡ Fixing `pluck()` so it returns only plucked values * ⬆️ Updating pnpm lockfile * 👕 Fixing lint errors * ⚡ Using workflow timezone to display dates * ✔️ Updating tests with workflow timezone * ⚡ Not using system timezone when creating Luxon dates * ⚡ Updating `merge()` and `pluck()` array functions * 🔀 Sync with `master`: Removing code that was preserved during merge * ⚡ Updating `.pluck()` to return full array if no arguments are passed * ⚡ Updating `keepFieldsContaining` and `merge` object functions * ⚡ Using week as default for `date.extract()` * ✅ Adding more test cases for DT functions * ⚡ Removing `Object.merge` extension function. Adding missing `deep-equal` dependency * ⚡ Handling `toDate` case when time component is not specified * ⚡ Using workflow's timezone to render dates in output panel, updated unit tests after removing `Object.merge` function * ⚡ Not parsing numbers as dates * 👕 Fixing lint errors * ⚡ Fixing a typo * ⚡ Making date detection more strict so only stringified dates are getting converted * 👌 Addressing PR feedback * 🔥 Removing leftover comment --------- Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-02-15 01:50:16 -08:00
});
test('.inBetween() should work on string and DateTime', () => {
expect(evaluate("={{ $now.isBetween($now, '2023-06-23') }}")).toBeDefined();
fix(core): Fix data transformation function that are reported not to work properly (#5338) * :fire: Remove test extensions * :construction: Add test description * :blue_book: Expand types * :zap: Export extensions * :zap: Export collection * :zap: Mark all proxies * :pencil2: Rename for clarity * :zap: Export from barrel * :sparkles: Create datatype completions * :zap: Mount datatype completions * :test_tube: Adjust tests * :zap: Add `path` prop * :fire: Remove `()` from completion labels * :zap: Filter out completions for pseudo-proxies * :bug: Fix method error * :zap: Add metrics * :pencil2: Improve naming * :sparkles: Start completion on empty resolvable * :sparkles: Implement completion previews * :zap: Break out completion manager * :zap: Implement in expression editor modal * :pencil2: Improve naming * :zap: Filter out irrelevant completions * :sparkles: Add preview hint * :pencil2: Improve comments * :art: Style preview hint * :zap: Expand `hasNoParams` * :zap: Add spacing for readability * :zap: Add error codes * :pencil2: Add comment * :bug: Fix Esc behavior * :zap: Parse Unicode * :zap: Throw on invalid `DateTime` * :zap: Fix second root completion detection * :zap: Switch message at completable prefix position * :bug: Fix function names for non-dev build * :bug: Fix `json` handling * :fire: Comment out previews * :recycle: Apply feedback * :fire: Remove extensions * :truck: Rename extensions * :zap: Adjust some implementations * :fire: Remove dummy extensions * :bug: Fix object regex * :recycle: Apply feedback * :pencil2: Fix typos * :pencil2: Add `fn is not a function` message * :fire: Remove check * :sparkles: Add `isNotEmpty` for objects * :truck: Rename `global` to `alpha` * :fire: Remove `encrypt` * :zap: Restore `is not a function` error * :zap: Support `week` on `extract()` * :test_tube: Fix tests * :zap: Add validation to some string extensions * :zap: Validate number arrays in some extensions * :test_tube: Fix tests * :pencil2: Improve error message * :rewind: Revert extensions framework changes * :broom: Previews cleanup * :zap: Condense blank completions * :zap: Refactor dollar completions * :zap: Refactor non-dollar completions * :zap: Refactor Luxon completions * :zap: Refactor datatype completions * :zap: Use `DATETIMEUNIT_MAP` * :pencil2: Update test description * :rewind: Revert "Use `DATETIMEUNIT_MAP`" This reverts commit 472a77df5cd789905d162f3c3db02ac767b89b4e. * :test_tube: Add tests * :recycle: Restore generic extensions * :fire: Remove logs * :test_tube: Expand tests * :sparkles: Add `Math` completions * :pencil2: List breaking change * :zap: Add doc tooltips * :bug: Fix node selector regex * :bug: Fix `context` resolution * :bug: Allow dollar completions in args * :zap: Make numeric array methods context-dependent * :pencil: Adjust docs * :bug: Fix selector ref * :zap: Surface error for valid URL * :bug: Disallow whitespace in `isEmail` check * :test_tube: Fix test for `isUrl` * :zap: Add comma validator in `toFloat` * :zap: Add validation to `$jmespath()` * :rewind: Revert valid URL error * :zap: Adjust `$jmespath()` validation * :test_tube: Adjust `isUrl` test * :zap: Remove `{}` and `[]` from compact * :pencil2: Update docs * :truck: Rename `stripTags` to `removeTags` * :zap: Do not inject whitespace inside resolvable * :zap: Make completions aware of `()` * :pencil2: Add note * :zap: Update sorting * :zap: Hide active node name from node selector * :fire: Remove `length()` and its aliases * :zap: Validate non-zero for `chunk` * :pencil2: Reword all error messages * :bug: Fix `$now` and `$today` * :zap: Simplify with `stripExcessParens` * :zap: Fold luxon into datatype * :test_tube: Clean up tests * :fire: Remove tests for removed methods * :shirt: Fix type * :arrow_up: Upgrade lang pack * :rewind: Undo change to `vitest` command * :fire: Remove unused method * :zap: Separate `return` line * :pencil2: Improve description * :test_tube: Expand tests for initial-only completions * :test_tube: Add bracket-aware completions * :zap: Make check for `all()` stricter * :pencil2: Adjust explanatory comments * :fire: Remove unneded copy * :fire: Remove outdated comment * :zap: Make naming consistent * :pencil2: Update comments * :zap: Improve URL scheme check * :pencil2: Add comment * :truck: Move extension * :pencil2: Update `BREAKING-CHANGES.md` * :pencil2: Update upcoming version * :pencil2: Fix grammar * :pencil2: Shorten message * :bug: Fix `Esc` behavior * :bug: Fix `isNumeric` * ✨ Using UTC to handle-dates on back-end * ✅ Added more unit tests for date extensions * ⚡ Not using `JSON.stringify` to render dates * ⚡ Using `deep-equal` library instead of our `deepCompare` function * ✅ Adding more tests to array extensions * ⚡ Fixing `inBetween` extension function * ✅ Added tests for `.inBetween()` * ⚡ Updating `isEven` and `isOdd` to throw for floats * ⚡ Updating `Array.merge()` so it works without arguments * 🔀 Fixing leftover merge confilct * ⚡ Updating `removeFieldsContaining` and `keepFieldsContaining` to throw on empty strings * ⚡ Fixing `pluck()` so it returns only plucked values * ⬆️ Updating pnpm lockfile * 👕 Fixing lint errors * ⚡ Using workflow timezone to display dates * ✔️ Updating tests with workflow timezone * ⚡ Not using system timezone when creating Luxon dates * ⚡ Updating `merge()` and `pluck()` array functions * 🔀 Sync with `master`: Removing code that was preserved during merge * ⚡ Updating `.pluck()` to return full array if no arguments are passed * ⚡ Updating `keepFieldsContaining` and `merge` object functions * ⚡ Using week as default for `date.extract()` * ✅ Adding more test cases for DT functions * ⚡ Removing `Object.merge` extension function. Adding missing `deep-equal` dependency * ⚡ Handling `toDate` case when time component is not specified * ⚡ Using workflow's timezone to render dates in output panel, updated unit tests after removing `Object.merge` function * ⚡ Not parsing numbers as dates * 👕 Fixing lint errors * ⚡ Fixing a typo * ⚡ Making date detection more strict so only stringified dates are getting converted * 👌 Addressing PR feedback * 🔥 Removing leftover comment --------- Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-02-15 01:50:16 -08:00
});
test('.inBetween() should not work for invalid strings', () => {
expect(evaluate("={{ $now.isBetween($now, 'invalid') }}")).toBeUndefined();
fix(core): Fix data transformation function that are reported not to work properly (#5338) * :fire: Remove test extensions * :construction: Add test description * :blue_book: Expand types * :zap: Export extensions * :zap: Export collection * :zap: Mark all proxies * :pencil2: Rename for clarity * :zap: Export from barrel * :sparkles: Create datatype completions * :zap: Mount datatype completions * :test_tube: Adjust tests * :zap: Add `path` prop * :fire: Remove `()` from completion labels * :zap: Filter out completions for pseudo-proxies * :bug: Fix method error * :zap: Add metrics * :pencil2: Improve naming * :sparkles: Start completion on empty resolvable * :sparkles: Implement completion previews * :zap: Break out completion manager * :zap: Implement in expression editor modal * :pencil2: Improve naming * :zap: Filter out irrelevant completions * :sparkles: Add preview hint * :pencil2: Improve comments * :art: Style preview hint * :zap: Expand `hasNoParams` * :zap: Add spacing for readability * :zap: Add error codes * :pencil2: Add comment * :bug: Fix Esc behavior * :zap: Parse Unicode * :zap: Throw on invalid `DateTime` * :zap: Fix second root completion detection * :zap: Switch message at completable prefix position * :bug: Fix function names for non-dev build * :bug: Fix `json` handling * :fire: Comment out previews * :recycle: Apply feedback * :fire: Remove extensions * :truck: Rename extensions * :zap: Adjust some implementations * :fire: Remove dummy extensions * :bug: Fix object regex * :recycle: Apply feedback * :pencil2: Fix typos * :pencil2: Add `fn is not a function` message * :fire: Remove check * :sparkles: Add `isNotEmpty` for objects * :truck: Rename `global` to `alpha` * :fire: Remove `encrypt` * :zap: Restore `is not a function` error * :zap: Support `week` on `extract()` * :test_tube: Fix tests * :zap: Add validation to some string extensions * :zap: Validate number arrays in some extensions * :test_tube: Fix tests * :pencil2: Improve error message * :rewind: Revert extensions framework changes * :broom: Previews cleanup * :zap: Condense blank completions * :zap: Refactor dollar completions * :zap: Refactor non-dollar completions * :zap: Refactor Luxon completions * :zap: Refactor datatype completions * :zap: Use `DATETIMEUNIT_MAP` * :pencil2: Update test description * :rewind: Revert "Use `DATETIMEUNIT_MAP`" This reverts commit 472a77df5cd789905d162f3c3db02ac767b89b4e. * :test_tube: Add tests * :recycle: Restore generic extensions * :fire: Remove logs * :test_tube: Expand tests * :sparkles: Add `Math` completions * :pencil2: List breaking change * :zap: Add doc tooltips * :bug: Fix node selector regex * :bug: Fix `context` resolution * :bug: Allow dollar completions in args * :zap: Make numeric array methods context-dependent * :pencil: Adjust docs * :bug: Fix selector ref * :zap: Surface error for valid URL * :bug: Disallow whitespace in `isEmail` check * :test_tube: Fix test for `isUrl` * :zap: Add comma validator in `toFloat` * :zap: Add validation to `$jmespath()` * :rewind: Revert valid URL error * :zap: Adjust `$jmespath()` validation * :test_tube: Adjust `isUrl` test * :zap: Remove `{}` and `[]` from compact * :pencil2: Update docs * :truck: Rename `stripTags` to `removeTags` * :zap: Do not inject whitespace inside resolvable * :zap: Make completions aware of `()` * :pencil2: Add note * :zap: Update sorting * :zap: Hide active node name from node selector * :fire: Remove `length()` and its aliases * :zap: Validate non-zero for `chunk` * :pencil2: Reword all error messages * :bug: Fix `$now` and `$today` * :zap: Simplify with `stripExcessParens` * :zap: Fold luxon into datatype * :test_tube: Clean up tests * :fire: Remove tests for removed methods * :shirt: Fix type * :arrow_up: Upgrade lang pack * :rewind: Undo change to `vitest` command * :fire: Remove unused method * :zap: Separate `return` line * :pencil2: Improve description * :test_tube: Expand tests for initial-only completions * :test_tube: Add bracket-aware completions * :zap: Make check for `all()` stricter * :pencil2: Adjust explanatory comments * :fire: Remove unneded copy * :fire: Remove outdated comment * :zap: Make naming consistent * :pencil2: Update comments * :zap: Improve URL scheme check * :pencil2: Add comment * :truck: Move extension * :pencil2: Update `BREAKING-CHANGES.md` * :pencil2: Update upcoming version * :pencil2: Fix grammar * :pencil2: Shorten message * :bug: Fix `Esc` behavior * :bug: Fix `isNumeric` * ✨ Using UTC to handle-dates on back-end * ✅ Added more unit tests for date extensions * ⚡ Not using `JSON.stringify` to render dates * ⚡ Using `deep-equal` library instead of our `deepCompare` function * ✅ Adding more tests to array extensions * ⚡ Fixing `inBetween` extension function * ✅ Added tests for `.inBetween()` * ⚡ Updating `isEven` and `isOdd` to throw for floats * ⚡ Updating `Array.merge()` so it works without arguments * 🔀 Fixing leftover merge confilct * ⚡ Updating `removeFieldsContaining` and `keepFieldsContaining` to throw on empty strings * ⚡ Fixing `pluck()` so it returns only plucked values * ⬆️ Updating pnpm lockfile * 👕 Fixing lint errors * ⚡ Using workflow timezone to display dates * ✔️ Updating tests with workflow timezone * ⚡ Not using system timezone when creating Luxon dates * ⚡ Updating `merge()` and `pluck()` array functions * 🔀 Sync with `master`: Removing code that was preserved during merge * ⚡ Updating `.pluck()` to return full array if no arguments are passed * ⚡ Updating `keepFieldsContaining` and `merge` object functions * ⚡ Using week as default for `date.extract()` * ✅ Adding more test cases for DT functions * ⚡ Removing `Object.merge` extension function. Adding missing `deep-equal` dependency * ⚡ Handling `toDate` case when time component is not specified * ⚡ Using workflow's timezone to render dates in output panel, updated unit tests after removing `Object.merge` function * ⚡ Not parsing numbers as dates * 👕 Fixing lint errors * ⚡ Fixing a typo * ⚡ Making date detection more strict so only stringified dates are getting converted * 👌 Addressing PR feedback * 🔥 Removing leftover comment --------- Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-02-15 01:50:16 -08:00
});
test('.inBetween() should not work for numbers', () => {
expect(evaluate('={{ $now.isBetween($now, 1) }}')).toBeUndefined();
fix(core): Fix data transformation function that are reported not to work properly (#5338) * :fire: Remove test extensions * :construction: Add test description * :blue_book: Expand types * :zap: Export extensions * :zap: Export collection * :zap: Mark all proxies * :pencil2: Rename for clarity * :zap: Export from barrel * :sparkles: Create datatype completions * :zap: Mount datatype completions * :test_tube: Adjust tests * :zap: Add `path` prop * :fire: Remove `()` from completion labels * :zap: Filter out completions for pseudo-proxies * :bug: Fix method error * :zap: Add metrics * :pencil2: Improve naming * :sparkles: Start completion on empty resolvable * :sparkles: Implement completion previews * :zap: Break out completion manager * :zap: Implement in expression editor modal * :pencil2: Improve naming * :zap: Filter out irrelevant completions * :sparkles: Add preview hint * :pencil2: Improve comments * :art: Style preview hint * :zap: Expand `hasNoParams` * :zap: Add spacing for readability * :zap: Add error codes * :pencil2: Add comment * :bug: Fix Esc behavior * :zap: Parse Unicode * :zap: Throw on invalid `DateTime` * :zap: Fix second root completion detection * :zap: Switch message at completable prefix position * :bug: Fix function names for non-dev build * :bug: Fix `json` handling * :fire: Comment out previews * :recycle: Apply feedback * :fire: Remove extensions * :truck: Rename extensions * :zap: Adjust some implementations * :fire: Remove dummy extensions * :bug: Fix object regex * :recycle: Apply feedback * :pencil2: Fix typos * :pencil2: Add `fn is not a function` message * :fire: Remove check * :sparkles: Add `isNotEmpty` for objects * :truck: Rename `global` to `alpha` * :fire: Remove `encrypt` * :zap: Restore `is not a function` error * :zap: Support `week` on `extract()` * :test_tube: Fix tests * :zap: Add validation to some string extensions * :zap: Validate number arrays in some extensions * :test_tube: Fix tests * :pencil2: Improve error message * :rewind: Revert extensions framework changes * :broom: Previews cleanup * :zap: Condense blank completions * :zap: Refactor dollar completions * :zap: Refactor non-dollar completions * :zap: Refactor Luxon completions * :zap: Refactor datatype completions * :zap: Use `DATETIMEUNIT_MAP` * :pencil2: Update test description * :rewind: Revert "Use `DATETIMEUNIT_MAP`" This reverts commit 472a77df5cd789905d162f3c3db02ac767b89b4e. * :test_tube: Add tests * :recycle: Restore generic extensions * :fire: Remove logs * :test_tube: Expand tests * :sparkles: Add `Math` completions * :pencil2: List breaking change * :zap: Add doc tooltips * :bug: Fix node selector regex * :bug: Fix `context` resolution * :bug: Allow dollar completions in args * :zap: Make numeric array methods context-dependent * :pencil: Adjust docs * :bug: Fix selector ref * :zap: Surface error for valid URL * :bug: Disallow whitespace in `isEmail` check * :test_tube: Fix test for `isUrl` * :zap: Add comma validator in `toFloat` * :zap: Add validation to `$jmespath()` * :rewind: Revert valid URL error * :zap: Adjust `$jmespath()` validation * :test_tube: Adjust `isUrl` test * :zap: Remove `{}` and `[]` from compact * :pencil2: Update docs * :truck: Rename `stripTags` to `removeTags` * :zap: Do not inject whitespace inside resolvable * :zap: Make completions aware of `()` * :pencil2: Add note * :zap: Update sorting * :zap: Hide active node name from node selector * :fire: Remove `length()` and its aliases * :zap: Validate non-zero for `chunk` * :pencil2: Reword all error messages * :bug: Fix `$now` and `$today` * :zap: Simplify with `stripExcessParens` * :zap: Fold luxon into datatype * :test_tube: Clean up tests * :fire: Remove tests for removed methods * :shirt: Fix type * :arrow_up: Upgrade lang pack * :rewind: Undo change to `vitest` command * :fire: Remove unused method * :zap: Separate `return` line * :pencil2: Improve description * :test_tube: Expand tests for initial-only completions * :test_tube: Add bracket-aware completions * :zap: Make check for `all()` stricter * :pencil2: Adjust explanatory comments * :fire: Remove unneded copy * :fire: Remove outdated comment * :zap: Make naming consistent * :pencil2: Update comments * :zap: Improve URL scheme check * :pencil2: Add comment * :truck: Move extension * :pencil2: Update `BREAKING-CHANGES.md` * :pencil2: Update upcoming version * :pencil2: Fix grammar * :pencil2: Shorten message * :bug: Fix `Esc` behavior * :bug: Fix `isNumeric` * ✨ Using UTC to handle-dates on back-end * ✅ Added more unit tests for date extensions * ⚡ Not using `JSON.stringify` to render dates * ⚡ Using `deep-equal` library instead of our `deepCompare` function * ✅ Adding more tests to array extensions * ⚡ Fixing `inBetween` extension function * ✅ Added tests for `.inBetween()` * ⚡ Updating `isEven` and `isOdd` to throw for floats * ⚡ Updating `Array.merge()` so it works without arguments * 🔀 Fixing leftover merge confilct * ⚡ Updating `removeFieldsContaining` and `keepFieldsContaining` to throw on empty strings * ⚡ Fixing `pluck()` so it returns only plucked values * ⬆️ Updating pnpm lockfile * 👕 Fixing lint errors * ⚡ Using workflow timezone to display dates * ✔️ Updating tests with workflow timezone * ⚡ Not using system timezone when creating Luxon dates * ⚡ Updating `merge()` and `pluck()` array functions * 🔀 Sync with `master`: Removing code that was preserved during merge * ⚡ Updating `.pluck()` to return full array if no arguments are passed * ⚡ Updating `keepFieldsContaining` and `merge` object functions * ⚡ Using week as default for `date.extract()` * ✅ Adding more test cases for DT functions * ⚡ Removing `Object.merge` extension function. Adding missing `deep-equal` dependency * ⚡ Handling `toDate` case when time component is not specified * ⚡ Using workflow's timezone to render dates in output panel, updated unit tests after removing `Object.merge` function * ⚡ Not parsing numbers as dates * 👕 Fixing lint errors * ⚡ Fixing a typo * ⚡ Making date detection more strict so only stringified dates are getting converted * 👌 Addressing PR feedback * 🔥 Removing leftover comment --------- Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-02-15 01:50:16 -08:00
});
test('.inBetween() should not work for a single argument', () => {
expect(() => evaluate('={{ $now.isBetween($now) }}')).toThrow();
fix(core): Fix data transformation function that are reported not to work properly (#5338) * :fire: Remove test extensions * :construction: Add test description * :blue_book: Expand types * :zap: Export extensions * :zap: Export collection * :zap: Mark all proxies * :pencil2: Rename for clarity * :zap: Export from barrel * :sparkles: Create datatype completions * :zap: Mount datatype completions * :test_tube: Adjust tests * :zap: Add `path` prop * :fire: Remove `()` from completion labels * :zap: Filter out completions for pseudo-proxies * :bug: Fix method error * :zap: Add metrics * :pencil2: Improve naming * :sparkles: Start completion on empty resolvable * :sparkles: Implement completion previews * :zap: Break out completion manager * :zap: Implement in expression editor modal * :pencil2: Improve naming * :zap: Filter out irrelevant completions * :sparkles: Add preview hint * :pencil2: Improve comments * :art: Style preview hint * :zap: Expand `hasNoParams` * :zap: Add spacing for readability * :zap: Add error codes * :pencil2: Add comment * :bug: Fix Esc behavior * :zap: Parse Unicode * :zap: Throw on invalid `DateTime` * :zap: Fix second root completion detection * :zap: Switch message at completable prefix position * :bug: Fix function names for non-dev build * :bug: Fix `json` handling * :fire: Comment out previews * :recycle: Apply feedback * :fire: Remove extensions * :truck: Rename extensions * :zap: Adjust some implementations * :fire: Remove dummy extensions * :bug: Fix object regex * :recycle: Apply feedback * :pencil2: Fix typos * :pencil2: Add `fn is not a function` message * :fire: Remove check * :sparkles: Add `isNotEmpty` for objects * :truck: Rename `global` to `alpha` * :fire: Remove `encrypt` * :zap: Restore `is not a function` error * :zap: Support `week` on `extract()` * :test_tube: Fix tests * :zap: Add validation to some string extensions * :zap: Validate number arrays in some extensions * :test_tube: Fix tests * :pencil2: Improve error message * :rewind: Revert extensions framework changes * :broom: Previews cleanup * :zap: Condense blank completions * :zap: Refactor dollar completions * :zap: Refactor non-dollar completions * :zap: Refactor Luxon completions * :zap: Refactor datatype completions * :zap: Use `DATETIMEUNIT_MAP` * :pencil2: Update test description * :rewind: Revert "Use `DATETIMEUNIT_MAP`" This reverts commit 472a77df5cd789905d162f3c3db02ac767b89b4e. * :test_tube: Add tests * :recycle: Restore generic extensions * :fire: Remove logs * :test_tube: Expand tests * :sparkles: Add `Math` completions * :pencil2: List breaking change * :zap: Add doc tooltips * :bug: Fix node selector regex * :bug: Fix `context` resolution * :bug: Allow dollar completions in args * :zap: Make numeric array methods context-dependent * :pencil: Adjust docs * :bug: Fix selector ref * :zap: Surface error for valid URL * :bug: Disallow whitespace in `isEmail` check * :test_tube: Fix test for `isUrl` * :zap: Add comma validator in `toFloat` * :zap: Add validation to `$jmespath()` * :rewind: Revert valid URL error * :zap: Adjust `$jmespath()` validation * :test_tube: Adjust `isUrl` test * :zap: Remove `{}` and `[]` from compact * :pencil2: Update docs * :truck: Rename `stripTags` to `removeTags` * :zap: Do not inject whitespace inside resolvable * :zap: Make completions aware of `()` * :pencil2: Add note * :zap: Update sorting * :zap: Hide active node name from node selector * :fire: Remove `length()` and its aliases * :zap: Validate non-zero for `chunk` * :pencil2: Reword all error messages * :bug: Fix `$now` and `$today` * :zap: Simplify with `stripExcessParens` * :zap: Fold luxon into datatype * :test_tube: Clean up tests * :fire: Remove tests for removed methods * :shirt: Fix type * :arrow_up: Upgrade lang pack * :rewind: Undo change to `vitest` command * :fire: Remove unused method * :zap: Separate `return` line * :pencil2: Improve description * :test_tube: Expand tests for initial-only completions * :test_tube: Add bracket-aware completions * :zap: Make check for `all()` stricter * :pencil2: Adjust explanatory comments * :fire: Remove unneded copy * :fire: Remove outdated comment * :zap: Make naming consistent * :pencil2: Update comments * :zap: Improve URL scheme check * :pencil2: Add comment * :truck: Move extension * :pencil2: Update `BREAKING-CHANGES.md` * :pencil2: Update upcoming version * :pencil2: Fix grammar * :pencil2: Shorten message * :bug: Fix `Esc` behavior * :bug: Fix `isNumeric` * ✨ Using UTC to handle-dates on back-end * ✅ Added more unit tests for date extensions * ⚡ Not using `JSON.stringify` to render dates * ⚡ Using `deep-equal` library instead of our `deepCompare` function * ✅ Adding more tests to array extensions * ⚡ Fixing `inBetween` extension function * ✅ Added tests for `.inBetween()` * ⚡ Updating `isEven` and `isOdd` to throw for floats * ⚡ Updating `Array.merge()` so it works without arguments * 🔀 Fixing leftover merge confilct * ⚡ Updating `removeFieldsContaining` and `keepFieldsContaining` to throw on empty strings * ⚡ Fixing `pluck()` so it returns only plucked values * ⬆️ Updating pnpm lockfile * 👕 Fixing lint errors * ⚡ Using workflow timezone to display dates * ✔️ Updating tests with workflow timezone * ⚡ Not using system timezone when creating Luxon dates * ⚡ Updating `merge()` and `pluck()` array functions * 🔀 Sync with `master`: Removing code that was preserved during merge * ⚡ Updating `.pluck()` to return full array if no arguments are passed * ⚡ Updating `keepFieldsContaining` and `merge` object functions * ⚡ Using week as default for `date.extract()` * ✅ Adding more test cases for DT functions * ⚡ Removing `Object.merge` extension function. Adding missing `deep-equal` dependency * ⚡ Handling `toDate` case when time component is not specified * ⚡ Using workflow's timezone to render dates in output panel, updated unit tests after removing `Object.merge` function * ⚡ Not parsing numbers as dates * 👕 Fixing lint errors * ⚡ Fixing a typo * ⚡ Making date detection more strict so only stringified dates are getting converted * 👌 Addressing PR feedback * 🔥 Removing leftover comment --------- Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-02-15 01:50:16 -08:00
});
test('.inBetween() should not work for a more than two arguments', () => {
expect(() =>
evaluate("={{ $now.isBetween($now, '2023-06-23', '2023-09-21'.toDate()) }}"),
).toThrow();
fix(core): Fix data transformation function that are reported not to work properly (#5338) * :fire: Remove test extensions * :construction: Add test description * :blue_book: Expand types * :zap: Export extensions * :zap: Export collection * :zap: Mark all proxies * :pencil2: Rename for clarity * :zap: Export from barrel * :sparkles: Create datatype completions * :zap: Mount datatype completions * :test_tube: Adjust tests * :zap: Add `path` prop * :fire: Remove `()` from completion labels * :zap: Filter out completions for pseudo-proxies * :bug: Fix method error * :zap: Add metrics * :pencil2: Improve naming * :sparkles: Start completion on empty resolvable * :sparkles: Implement completion previews * :zap: Break out completion manager * :zap: Implement in expression editor modal * :pencil2: Improve naming * :zap: Filter out irrelevant completions * :sparkles: Add preview hint * :pencil2: Improve comments * :art: Style preview hint * :zap: Expand `hasNoParams` * :zap: Add spacing for readability * :zap: Add error codes * :pencil2: Add comment * :bug: Fix Esc behavior * :zap: Parse Unicode * :zap: Throw on invalid `DateTime` * :zap: Fix second root completion detection * :zap: Switch message at completable prefix position * :bug: Fix function names for non-dev build * :bug: Fix `json` handling * :fire: Comment out previews * :recycle: Apply feedback * :fire: Remove extensions * :truck: Rename extensions * :zap: Adjust some implementations * :fire: Remove dummy extensions * :bug: Fix object regex * :recycle: Apply feedback * :pencil2: Fix typos * :pencil2: Add `fn is not a function` message * :fire: Remove check * :sparkles: Add `isNotEmpty` for objects * :truck: Rename `global` to `alpha` * :fire: Remove `encrypt` * :zap: Restore `is not a function` error * :zap: Support `week` on `extract()` * :test_tube: Fix tests * :zap: Add validation to some string extensions * :zap: Validate number arrays in some extensions * :test_tube: Fix tests * :pencil2: Improve error message * :rewind: Revert extensions framework changes * :broom: Previews cleanup * :zap: Condense blank completions * :zap: Refactor dollar completions * :zap: Refactor non-dollar completions * :zap: Refactor Luxon completions * :zap: Refactor datatype completions * :zap: Use `DATETIMEUNIT_MAP` * :pencil2: Update test description * :rewind: Revert "Use `DATETIMEUNIT_MAP`" This reverts commit 472a77df5cd789905d162f3c3db02ac767b89b4e. * :test_tube: Add tests * :recycle: Restore generic extensions * :fire: Remove logs * :test_tube: Expand tests * :sparkles: Add `Math` completions * :pencil2: List breaking change * :zap: Add doc tooltips * :bug: Fix node selector regex * :bug: Fix `context` resolution * :bug: Allow dollar completions in args * :zap: Make numeric array methods context-dependent * :pencil: Adjust docs * :bug: Fix selector ref * :zap: Surface error for valid URL * :bug: Disallow whitespace in `isEmail` check * :test_tube: Fix test for `isUrl` * :zap: Add comma validator in `toFloat` * :zap: Add validation to `$jmespath()` * :rewind: Revert valid URL error * :zap: Adjust `$jmespath()` validation * :test_tube: Adjust `isUrl` test * :zap: Remove `{}` and `[]` from compact * :pencil2: Update docs * :truck: Rename `stripTags` to `removeTags` * :zap: Do not inject whitespace inside resolvable * :zap: Make completions aware of `()` * :pencil2: Add note * :zap: Update sorting * :zap: Hide active node name from node selector * :fire: Remove `length()` and its aliases * :zap: Validate non-zero for `chunk` * :pencil2: Reword all error messages * :bug: Fix `$now` and `$today` * :zap: Simplify with `stripExcessParens` * :zap: Fold luxon into datatype * :test_tube: Clean up tests * :fire: Remove tests for removed methods * :shirt: Fix type * :arrow_up: Upgrade lang pack * :rewind: Undo change to `vitest` command * :fire: Remove unused method * :zap: Separate `return` line * :pencil2: Improve description * :test_tube: Expand tests for initial-only completions * :test_tube: Add bracket-aware completions * :zap: Make check for `all()` stricter * :pencil2: Adjust explanatory comments * :fire: Remove unneded copy * :fire: Remove outdated comment * :zap: Make naming consistent * :pencil2: Update comments * :zap: Improve URL scheme check * :pencil2: Add comment * :truck: Move extension * :pencil2: Update `BREAKING-CHANGES.md` * :pencil2: Update upcoming version * :pencil2: Fix grammar * :pencil2: Shorten message * :bug: Fix `Esc` behavior * :bug: Fix `isNumeric` * ✨ Using UTC to handle-dates on back-end * ✅ Added more unit tests for date extensions * ⚡ Not using `JSON.stringify` to render dates * ⚡ Using `deep-equal` library instead of our `deepCompare` function * ✅ Adding more tests to array extensions * ⚡ Fixing `inBetween` extension function * ✅ Added tests for `.inBetween()` * ⚡ Updating `isEven` and `isOdd` to throw for floats * ⚡ Updating `Array.merge()` so it works without arguments * 🔀 Fixing leftover merge confilct * ⚡ Updating `removeFieldsContaining` and `keepFieldsContaining` to throw on empty strings * ⚡ Fixing `pluck()` so it returns only plucked values * ⬆️ Updating pnpm lockfile * 👕 Fixing lint errors * ⚡ Using workflow timezone to display dates * ✔️ Updating tests with workflow timezone * ⚡ Not using system timezone when creating Luxon dates * ⚡ Updating `merge()` and `pluck()` array functions * 🔀 Sync with `master`: Removing code that was preserved during merge * ⚡ Updating `.pluck()` to return full array if no arguments are passed * ⚡ Updating `keepFieldsContaining` and `merge` object functions * ⚡ Using week as default for `date.extract()` * ✅ Adding more test cases for DT functions * ⚡ Removing `Object.merge` extension function. Adding missing `deep-equal` dependency * ⚡ Handling `toDate` case when time component is not specified * ⚡ Using workflow's timezone to render dates in output panel, updated unit tests after removing `Object.merge` function * ⚡ Not parsing numbers as dates * 👕 Fixing lint errors * ⚡ Fixing a typo * ⚡ Making date detection more strict so only stringified dates are getting converted * 👌 Addressing PR feedback * 🔥 Removing leftover comment --------- Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
2023-02-15 01:50:16 -08:00
});
feat: Expression extension framework (#4372) * :zap: Introduce a framework for expression extension * :bulb: Add some inline comments * :zap: Introduce hash alias for encrypt * :zap: Introduce a manual granular level approach to shadowing/overrideing extensions * :fire: Cleanup comments * :zap: Introduce a basic method of extension for native functions * :zap: Add length to StringExtension * :zap: Add number type to extension return types * :zap: Temporarily introduce DateTime with extension * :zap: Cleanup comments * :zap: Organize imports * :recycle: Fix up some typings * :zap: Fix typings * :recycle: Remove unnecessary resolve of expression * :zap: Extensions Improvement * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Refactor EXPRESSION_EXTENSION_METHODS * :recycle: Update extraArgs types * :recycle: Fix tests * :recycle: Fix bind type issue * :recycle: Fixing duration type issue * :recycle: Refactor to allow overrides on native methods * :recycle: Temporarily remove Date Extensions to pass tests * feat(dt-functions): introduce date expression extensions (#4045) * :tada: Add Date Extensions into the mix * :sparkles: Introduce additional date extension methods * :white_check_mark: Add Date Expression Extension tests * :wrench: Add ability to debug tests * :recycle: Refactor extension for native types * :fire: Move sayHi method to String Extension class * :recycle: Update scope when binding member methods * :white_check_mark: Add String Extension tests * feat(dt-functions): introduce array expression extensions (#4044) * :sparkles: Introduce Array Extensions * :white_check_mark: Add Array Expression tests * feat(dt-functions): introduce number expression extensions (#4046) * :tada: Introduce Number Extensions * :zap: Support more shared extensions * :zap: Improve handling of name collision * :white_check_mark: Update tests * Fixed up tests * :fire: Remove remove markdown * :recylce: Replace remove-markdown dependencies with implementation * :recycle: Replace remove-markdown dependencies with implementation * :white_check_mark: Update tests * :recycle: Fix scoping and cleanup * :recycle: Update comments and errors * :recycle: Fix linting errors * :heavy_minus_sign: Remove unused dependencies * fix: expression extension not working with multiple extensions * refactor: change extension transform to be more efficient * test: update most test to work with new extend function * fix: update and fix type error in config * refactor: replace babel with recast * feat: add hashing functions to string extension * fix: removed export * test: add extension parser and transform tests * fix: vite tests breaking * refactor: remove commented out code * fix: parse dates passed from $json in extend function * refactor: review feedback changes for date extensions * refactor: review feedback changes for number extensions * fix: date extension beginningOf test * fix: broken build from merge * fix: another merge issue * refactor: address review feedback (remove ignores) * feat: new extension functions and tests * feat: non-dot notation functions * test: most of the other tests * fix: toSentenceCase for node versions below 16.6 * feat: add $if and $not expression extensions * Fix test to work on every timezone * lint: fix remaining lint issues Co-authored-by: Csaba Tuncsik <csaba@n8n.io> Co-authored-by: Omar Ajoue <krynble@gmail.com>
2023-01-10 05:06:12 -08:00
});
});