You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We have long since preferred using Jest for unit tests within the Kibana repository, and from what I can tell there is no reason all existing Mocha tests can not be migrated to Jest. This meta issue will serve to track the migration of those tests and the cleanup to follow.
dateMath
errors
✓ should return undefined if passed something falsy
✓ should return undefined if I pass an operator besides [+-/]
✓ should return undefined if I pass a unit besidess,m,h,d,w,M,y,ms
✓ should return undefined if rounding unit is not 1
✓ should not go into an infinite loop when missing a unit
forceNow
✓ should throw an Error if passed a string
✓ should throw an Error if passed a moment
✓ should throw an Error if passed an invalid date
objects and strings
✓ should return the same moment if passed a moment
✓ should return a moment if passed a date
✓ should return a moment if passed an ISO8601 string
✓ should return the current time when parsing now
✓ should use the forceNow parameter when parsing now
subtraction
✓ should return 5s ago
✓ should return 5s before 2014-01-01T06:06:06.666Z
✓ should return 5s before forceNow
✓ should return 5m ago
✓ should return 5m before 2014-01-01T06:06:06.666Z
✓ should return 5m before forceNow
✓ should return 5h ago
✓ should return 5h before 2014-01-01T06:06:06.666Z
✓ should return 5h before forceNow
✓ should return 5d ago
✓ should return 5d before 2014-01-01T06:06:06.666Z
✓ should return 5d before forceNow
✓ should return 5w ago
✓ should return 5w before 2014-01-01T06:06:06.666Z
✓ should return 5w before forceNow
✓ should return 5M ago
✓ should return 5M before 2014-01-01T06:06:06.666Z
✓ should return 5M before forceNow
✓ should return 5y ago
✓ should return 5y before 2014-01-01T06:06:06.666Z
✓ should return 5y before forceNow
✓ should return 5ms ago
✓ should return 5ms before 2014-01-01T06:06:06.666Z
✓ should return 5ms before forceNow
✓ should return 12s ago
✓ should return 12s before 2014-01-01T06:06:06.666Z
✓ should return 12s before forceNow
✓ should return 12m ago
✓ should return 12m before 2014-01-01T06:06:06.666Z
✓ should return 12m before forceNow
✓ should return 12h ago
✓ should return 12h before 2014-01-01T06:06:06.666Z
✓ should return 12h before forceNow
✓ should return 12d ago
✓ should return 12d before 2014-01-01T06:06:06.666Z
✓ should return 12d before forceNow
✓ should return 12w ago
✓ should return 12w before 2014-01-01T06:06:06.666Z
✓ should return 12w before forceNow
✓ should return 12M ago
✓ should return 12M before 2014-01-01T06:06:06.666Z
✓ should return 12M before forceNow
✓ should return 12y ago
✓ should return 12y before 2014-01-01T06:06:06.666Z
✓ should return 12y before forceNow
✓ should return 12ms ago
✓ should return 12ms before 2014-01-01T06:06:06.666Z
✓ should return 12ms before forceNow
✓ should return 247s ago
✓ should return 247s before 2014-01-01T06:06:06.666Z
✓ should return 247s before forceNow
✓ should return 247m ago
✓ should return 247m before 2014-01-01T06:06:06.666Z
✓ should return 247m before forceNow
✓ should return 247h ago
✓ should return 247h before 2014-01-01T06:06:06.666Z
✓ should return 247h before forceNow
✓ should return 247d ago
✓ should return 247d before 2014-01-01T06:06:06.666Z
✓ should return 247d before forceNow
✓ should return 247w ago
✓ should return 247w before 2014-01-01T06:06:06.666Z
✓ should return 247w before forceNow
✓ should return 247M ago
✓ should return 247M before 2014-01-01T06:06:06.666Z
✓ should return 247M before forceNow
✓ should return 247y ago
✓ should return 247y before 2014-01-01T06:06:06.666Z
✓ should return 247y before forceNow
✓ should return 247ms ago
✓ should return 247ms before 2014-01-01T06:06:06.666Z
✓ should return 247ms before forceNow
addition
✓ should return 5s from now
✓ should return 5s after 2014-01-01T06:06:06.666Z
✓ should return 5s after forceNow
✓ should return 5m from now
✓ should return 5m after 2014-01-01T06:06:06.666Z
✓ should return 5m after forceNow
✓ should return 5h from now
✓ should return 5h after 2014-01-01T06:06:06.666Z
✓ should return 5h after forceNow
✓ should return 5d from now
✓ should return 5d after 2014-01-01T06:06:06.666Z
✓ should return 5d after forceNow
✓ should return 5w from now
✓ should return 5w after 2014-01-01T06:06:06.666Z
✓ should return 5w after forceNow
✓ should return 5M from now
✓ should return 5M after 2014-01-01T06:06:06.666Z
✓ should return 5M after forceNow
✓ should return 5y from now
✓ should return 5y after 2014-01-01T06:06:06.666Z
✓ should return 5y after forceNow
✓ should return 5ms from now
✓ should return 5ms after 2014-01-01T06:06:06.666Z
✓ should return 5ms after forceNow
✓ should return 12s from now
✓ should return 12s after 2014-01-01T06:06:06.666Z
✓ should return 12s after forceNow
✓ should return 12m from now
✓ should return 12m after 2014-01-01T06:06:06.666Z
✓ should return 12m after forceNow
✓ should return 12h from now
✓ should return 12h after 2014-01-01T06:06:06.666Z
✓ should return 12h after forceNow
✓ should return 12d from now
✓ should return 12d after 2014-01-01T06:06:06.666Z
✓ should return 12d after forceNow
✓ should return 12w from now
✓ should return 12w after 2014-01-01T06:06:06.666Z
✓ should return 12w after forceNow
✓ should return 12M from now
✓ should return 12M after 2014-01-01T06:06:06.666Z
✓ should return 12M after forceNow
✓ should return 12y from now
✓ should return 12y after 2014-01-01T06:06:06.666Z
✓ should return 12y after forceNow
✓ should return 12ms from now
✓ should return 12ms after 2014-01-01T06:06:06.666Z
✓ should return 12ms after forceNow
✓ should return 247s from now
✓ should return 247s after 2014-01-01T06:06:06.666Z
✓ should return 247s after forceNow
✓ should return 247m from now
✓ should return 247m after 2014-01-01T06:06:06.666Z
✓ should return 247m after forceNow
✓ should return 247h from now
✓ should return 247h after 2014-01-01T06:06:06.666Z
✓ should return 247h after forceNow
✓ should return 247d from now
✓ should return 247d after 2014-01-01T06:06:06.666Z
✓ should return 247d after forceNow
✓ should return 247w from now
✓ should return 247w after 2014-01-01T06:06:06.666Z
✓ should return 247w after forceNow
✓ should return 247M from now
✓ should return 247M after 2014-01-01T06:06:06.666Z
✓ should return 247M after forceNow
✓ should return 247y from now
✓ should return 247y after 2014-01-01T06:06:06.666Z
✓ should return 247y after forceNow
✓ should return 247ms from now
✓ should return 247ms after 2014-01-01T06:06:06.666Z
✓ should return 247ms after forceNow
rounding
✓ should round now to the beginning of the s
✓ should round now to the beginning of forceNow's s
✓ should round now to the end of the s
✓ should round now to the end of forceNow's s
✓ should round now to the beginning of the m
✓ should round now to the beginning of forceNow's m
✓ should round now to the end of the m
✓ should round now to the end of forceNow's m
✓ should round now to the beginning of the h
✓ should round now to the beginning of forceNow's h
✓ should round now to the end of the h
✓ should round now to the end of forceNow's h
✓ should round now to the beginning of the d
✓ should round now to the beginning of forceNow's d
✓ should round now to the end of the d
✓ should round now to the end of forceNow's d
✓ should round now to the beginning of the w
✓ should round now to the beginning of forceNow's w
✓ should round now to the end of the w
✓ should round now to the end of forceNow's w
✓ should round now to the beginning of the M
✓ should round now to the beginning of forceNow's M
✓ should round now to the end of the M
✓ should round now to the end of forceNow's M
✓ should round now to the beginning of the y
✓ should round now to the beginning of forceNow's y
✓ should round now to the end of the y
✓ should round now to the end of forceNow's y
✓ should round now to the beginning of the ms
✓ should round now to the beginning of forceNow's ms
✓ should round now to the end of the ms
✓ should round now to the end of forceNow's ms
math and rounding
✓ should round to the nearest second with 0 value
✓ should subtract 17s, rounded to the nearest second
✓ should add 555ms, rounded to the nearest millisecond
✓ should subtract 555ms, rounded to the nearest second
✓ should round weeks to Sunday by default
✓ should round weeks based on the passed moment locale start of week setting
✓ should round up weeks based on the passed moment locale start of week setting
✓ should round relative to forceNow
✓ should parse long expressions
used momentjs instance
✓ should use the default moment instance if parameter not specified
✓ should not use default moment instance if parameter is specified
✓ should work with multiple different instances
✓ should use global instance after passing an instance
units
✓ should have units descending for unitsDesc
✓ should have units ascending for unitsAsc
esArchiver createFormatArchiveStreams
{ gzip: false }
✓ returns an array of streams
✓ streams consume js values and produces buffers
✓ product is pretty-printed JSON separated by two newlines
{ gzip: true }
✓ returns an array of streams
✓ streams consume js values and produces buffers
✓ output can be gunzipped
defaults
✓ product is not gzipped
esArchiver createParseArchiveStreams
{ gzip: false }
✓ returns an array of streams
streams
✓ consume buffers of valid JSON
✓ consume buffers of valid JSON separated by two newlines
✓ provides each JSON object as soon as it is parsed
stream errors
✓ stops when any document contains invalid json
{ gzip: true }
✓ returns an array of streams
✓ parses blank files
streams
✓ consumes gzipped buffers of valid JSON
✓ parses valid gzipped JSON strings separated by two newlines
stream errors
✓ stops when the input is not valid gzip archive
defaults
✓ does not try to gunzip the content
esArchiver: createGenerateDocRecordsStream()
✓ scolls 1000 documents at a time
✓ uses a 1 minute scroll timeout
✓ consumes index names and scrolls completely before continuing
esArchiver: createIndexDocRecordsStream()
✓ consumes doc records and sends to `_bulk` api
✓ consumes multiple doc records and sends to `_bulk` api together
✓ waits until request is complete before sending more
✓ sends a maximum of 300 documents at a time
✓ emits an error if any request fails
esArchiver: createCreateIndexStream()
defaults
✓ deletes existing indices, creates all
✓ deletes existing aliases, creates all
✓ passes through "hit" records
✓ creates aliases
✓ passes through records with unknown types
✓ passes through non-record values
skipExisting = true
✓ ignores preexisting indexes
✓ filters documents for skipped indices
esArchiver: createDeleteIndexStream()
✓ deletes the index without checking if it exists
✓ reports the delete when the index existed
esArchiver: createGenerateIndexRecordsStream()
✓ consumes index names and queries for the mapping of each
✓ filters index metadata from settings
✓ produces one index record for each index name it receives
✓ understands aliases
esArchiver: createFilterRecordsStream()
✓ consumes any value
✓ produces record values that have a matching type
246 passing (2s)
The text was updated successfully, but these errors were encountered:
We have long since preferred using Jest for unit tests within the Kibana repository, and from what I can tell there is no reason all existing Mocha tests can not be migrated to Jest. This meta issue will serve to track the migration of those tests and the cleanup to follow.
@elastic/datemath
tests to Jest__tests__
directoriesfind src x-pack packages -iname \*.test.ts -o -iname \*.test.js | fgrep __tests__
@kbn/es-archiver
tests to JestRelated to #70733
The text was updated successfully, but these errors were encountered: