Revert backwards incompatible changes to HTTPClient interface #690
GitHub Actions / Jest Tests 18
succeeded
Dec 18, 2024 in 1s
345 passed, 0 failed and 1 skipped
✅ reports/jest-junit.xml
346 tests were completed in 16s with 345 passed, 0 failed and 1 skipped.
✅ tests/functional/feed-client-configuration.test.ts
FeedClientConfiguration
✅ can be instantiated directly with a token
✅ can be instantiated directly with a lambda
✅ throws a RangeError if 'max_backoff' is less than or equal to zero
✅ throws a TypeError if long_type provided is undefined
✅ throws a TypeError if httpClient provided is undefined
✅ throws a TypeError if max_backoff provided is undefined
✅ throws a TypeError if max_attempts provided is undefined
✅ throws a TypeError if client_timeout_buffer_ms provided is undefined
✅ throws a TypeError if query_timeout_ms provided is undefined
✅ throws a TypeError if secret provided is undefined
✅ throws a RangeError if 'max_attempts' is less than or equal to zero
✅ throws a TypeError is start_ts and cursor are both provided
✅ throws a RangeError if 'query_timeout_ms' is less than or equal to zero
✅ throws a RangeError if 'client_timeout_buffer_ms' is less than or equal to zero
✅ throws a TypeError if 'cursor' is not a string
✅ tests/functional/feed-client.test.ts
FeedClient
✅ returns a valid page of events
✅ uses a valid HTTPRequest
✅ uses page_size when set
✅ uses cursor when set
✅ uses start_ts when set
✅ retries throttling errors
✅ throws an error for an error response
✅ tests/functional/stream-client-configuration.test.ts
StreamClientConfiguration
✅ can be instantiated directly with a token
✅ can be instantiated directly with a lambda
✅ throws a TypeError if long_type provided is undefined
✅ throws a TypeError if httpStreamClient provided is undefined
✅ throws a TypeError if max_backoff provided is undefined
✅ throws a TypeError if max_attempts provided is undefined
✅ throws a TypeError if secret provided is undefined
✅ throws a RangeError if 'max_backoff' is less than or equal to zero
✅ throws a RangeError if 'max_attempts' is less than or equal to zero
✅ tests/integration/doc.test.ts
querying for doc types
✅ can round-trip Module
✅ can round-trip DocumentReference to a non-existent doc
✅ can round-trip DocumentReference to an existent doc
✅ can round-trip Document
✅ can round-trip NamedDocumentReference
✅ can round-trip NamedDocument
✅ get doc types from FQL
✅ can set and read ttl
✅ tests/integration/existing-collection.test.ts
querying for existing data
✅ Can query an existing index
✅ tests/integration/feed.test.ts
Client
✅ should throw a ClientError if not using a stream token
✅ should return a iterable feed from a stream token
✅ should return an iterable feed with a lambda
✅ should pass configuration to the feed client
✅ can resume from a cursor using a query
FeedClient
✅ can be instantiated directly with a token and client configuration
✅ can pass an existing cursor
✅ throws an error on an error event within a page of events
✅ can return a flattened array of events
✅ throws a QueryTimeoutError if the query times out
✅ throws a NetworkError if the client times out
✅ tests/integration/query-limits.test.ts
Query with limits enabled
⚪ succeeds on retry after getting throttled
✅ tests/integration/query-typings.test.ts
query typings
✅ allows customers to use their own types in queries
✅ allows customers to use their own interfaces in queries
✅ allows customers to infer their own types in queries from fql statements
✅ allows customers to use subtyped queries
paginate typings
✅ allows customers to use their own types in queries
✅ allows customers to use their own interfaces in queries
✅ allows customers to infer their own types in queries from fql statements
✅ allows customers to use subtyped queries
✅ tests/integration/schema-version.test.ts
schema version is returned by the client
✅ returns the schema version
✅ tests/integration/stream.test.ts
Client
✅ can initiate a stream from a Client
✅ can initiate a stream from a Client, providing a query
✅ can resume a stream from an event cursor
✅ rejects cursor when not using a stream token
StreamClient
✅ can initiate a stream
✅ can initiate a stream with a lambda
✅ can get events with async iterator
✅ can get events with callbacks
✅ catches InvalidRequestError when establishing a stream
✅ handles InvalidRequestError via callback when establishing a stream
✅ catches an AbortError if abort is called when processing an event
✅ catches a QueryRuntimeError when processing an event
✅ handles an AbortError via callback if abort is called when processing an event
✅ handles a QueryRuntimeError via callback when processing an event
✅ decodes values from streams correctly
✅ yields all events when Fauna sends them as a single chunk
✅ tests/integration/template-format.test.ts
query using template format
✅ succeeds with no arguments
✅ succeeds with a string variable
✅ succeeds with an Int variable
✅ succeeds with a Long variable
✅ succeeds with a Double variable
✅ succeeds with a boolean variable
✅ succeeds with a null variable
✅ succeeds with an object variable
✅ succeeds with an array variable
✅ succeeds with multiple variables
✅ succeeds with nested expressions
✅ succeeds with deep nested expressions
✅ succeeds with deep nested expressions - example 2
✅ succeeds with expressions nested within objects
✅ succeeds with expressions nested within arrays
✅ succeeds with expressions nested within arrays and objects combined
✅ succeeds with multiple layers of nesting of arrays and objects
✅ succeeds with FQL string interpolation
✅ succeeds with a Date arg
✅ succeeds with an ArrayBuffer variable
✅ succeeds with Uint8Array variables
✅ fails with [Function Int8Array] variables
✅ fails with [Function Uint8ClampedArray] variables
✅ fails with [Function Int16Array] variables
✅ fails with [Function Uint16Array] variables
✅ fails with [Function Int32Array] variables
✅ fails with [Function Uint32Array] variables
✅ fails with [Function Float32Array] variables
✅ fails with [Function Float64Array] variables
✅ fails with [Function BigInt64Array] variables
✅ fails with [Function BigUint64Array] variables
✅ succeeds using Node Buffer to encode strings
✅ tests/unit/client.test.ts
Client
✅ Allows setting a secret in query
✅ Refuses further requests after close
✅ Refuses calls to close after client is closed.
✅ Allows for creation and usage of a new client after first client closed.
✅ tests/unit/datetime.test.ts
values
✅ can construct TimeStub from strings: Z
✅ can construct TimeStub from strings: - HH:MM
✅ can construct TimeStub from strings: - HHMM
✅ can construct TimeStub from strings: + HH:MM
✅ can construct TimeStub from strings: + HHMM
✅ can construct TimeStub from strings: +yyyyy
✅ can construct TimeStub from strings: -yyyy
✅ can construct DateStub from strings: some date
✅ can construct DateStub from strings: leap year
✅ can construct TimeStub from Date: Z
✅ can construct TimeStub from Date: - HH:MM
✅ can construct TimeStub from Date: + HH:MM
✅ can construct TimeStub from Date: no timezone
✅ can construct TimeStub from Date: no time
✅ can construct DateStub from Date: Z
✅ can construct DateStub from Date: - HH:MM
✅ can construct DateStub from Date: + HH:MM
✅ can construct DateStub from Date: no timezone
✅ can construct DateStub from Date: no time
✅ can deconstruct TimeStub into a Date: Z
✅ can deconstruct TimeStub into a Date: - HH:MM
✅ can deconstruct TimeStub into a Date: - HHMM
✅ can deconstruct TimeStub into a Date: + HH:MM
✅ can deconstruct TimeStub into a Date: + HHMM
✅ can deconstruct TimeStub into a Date: +yyyyy
✅ can deconstruct TimeStub into a Date: -yyyy
✅ can deconstruct DateStub into a Date: some date
✅ can deconstruct DateStub into a Date: leap year
✅ tests/unit/doc.test.ts
Module
✅ can be constructed directly
DocumentReference
✅ can be constructed directly
Document
✅ can be constructed directly
✅ can access ttl
✅ can access user data
NamedDocumentReference
✅ can be constructed directly
NamedDocument
✅ can be constructed without data
✅ can be constructed without data
NullDocument
✅ can be constructed directly with a DocumentReference
✅ can be constructed directly with a NamedDocumentReference
✅ tests/unit/error.test.ts
query
✅ QueryFailures with status '400' and code 'invalid_query' are correctly mapped to [Function QueryCheckError]
✅ QueryFailures with status '400' and code 'unbound_variable' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'index_out_of_bounds' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'type_mismatch' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_argument' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_bounds' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_regex' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_schema' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_document_id' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'document_id_exists' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'document_not_found' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'document_deleted' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_function_invocation' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_index_invocation' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'null_value' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_null_access' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_cursor' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'permission_denied' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_effect' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_write' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'internal_failure' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'divide_by_zero' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_id' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_secret' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_time' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_unit' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_date' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'limit_exceeded' are correctly mapped to [Function ThrottlingError]
✅ QueryFailures with status '400' and code 'stack_overflow' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_computed_field_access' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'disabled_feature' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_receiver' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_timestamp_field_access' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '400' and code 'invalid_request' are correctly mapped to [Function InvalidRequestError]
✅ QueryFailures with status '400' and code 'abort' are correctly mapped to [Function AbortError]
✅ QueryFailures with status '400' and code 'constraint_failure' are correctly mapped to [Function ConstraintFailureError]
✅ QueryFailures with status '401' and code 'unauthorized' are correctly mapped to [Function AuthenticationError]
✅ QueryFailures with status '403' and code 'forbidden' are correctly mapped to [Function AuthorizationError]
✅ QueryFailures with status '409' and code 'contended_transaction' are correctly mapped to [Function ContendedTransactionError]
✅ QueryFailures with status '429' and code 'limit_exceeded' are correctly mapped to [Function ThrottlingError]
✅ QueryFailures with status '440' and code 'time_out' are correctly mapped to [Function QueryTimeoutError]
✅ QueryFailures with status '503' and code 'time_out' are correctly mapped to [Function QueryTimeoutError]
✅ QueryFailures with status '500' and code 'internal_error' are correctly mapped to [Function ServiceInternalError]
✅ QueryFailures with status '400' and code 'some unhandled code' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '401' and code 'some unhandled code' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '403' and code 'some unhandled code' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '409' and code 'some unhandled code' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '429' and code 'some unhandled code' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '440' and code 'some unhandled code' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '500' and code 'some unhandled code' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '503' and code 'some unhandled code' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status '999' and code 'some unhandled code' are correctly mapped to [Function QueryRuntimeError]
✅ QueryFailures with status 'undefined' and code 'some unhandled code' are correctly mapped to [Function QueryRuntimeError]
✅ tests/unit/fetch-client.test.ts
fetch client
✅ returns a valid query response on success
✅ returns a valid query response on failure
✅ returns a NetworkError if fetch rejects
✅ returns a NetworkError if client timeout causes an abort
✅ uses the default path if one is not provided in HttpRequest
✅ uses the path provided in the HttpRequest if provided
✅ tests/unit/logger.test.ts
logging › parseDebugLevel
✅ correctly parses '0' to log level '0'
✅ correctly parses '1' to log level '1'
✅ correctly parses '2' to log level '2'
✅ correctly parses '3' to log level '3'
✅ correctly parses '4' to log level '4'
✅ correctly parses '5' to log level '5'
✅ correctly parses '6' to log level '6'
✅ correctly parses LOG_LEVELS.TRACE to log level '0'
✅ correctly parses LOG_LEVELS.DEBUG to log level '1'
✅ correctly parses LOG_LEVELS.INFO to log level '2'
✅ correctly parses LOG_LEVELS.WARN to log level '3'
✅ correctly parses LOG_LEVELS.ERROR to log level '4'
✅ correctly parses LOG_LEVELS.FATAL to log level '5'
✅ correctly parses LOG_LEVELS.OFF to log level '6'
✅ correctly parses empty to log level '6'
✅ correctly parses null to log level '6'
✅ correctly parses undefined to log level '6'
✅ correctly parses unkown number string to log level '6'
✅ correctly parses unknown string to log level '6'
✅ correctly parses number to log level '6'
levels › TRACE log level
✅ always log
levels › DEBUG log level
✅ skipped
✅ debug
✅ warn
levels › ERROR log level
✅ skipped
✅ logged
FATAL log level
✅ skipped
✅ logged
OFF log level
✅ skipped
Log messages › Log message construction
✅ trace
✅ debug
✅ info
✅ warn
✅ error
✅ tests/unit/node-http2-client.test.ts
node http2 client
✅ default client for Node.js is the NodeHTTP2Client
✅ uses the default request path if none is provided
✅ uses the path provided in HttpRequest if provided
✅ tests/unit/package-verison.test.ts
package version
✅ is correct
✅ tests/unit/query-builder.test.ts
fql method producing Querys
✅ parses with no variables
✅ parses with a string variable
✅ parses with a number variable
✅ parses with a boolean variable
✅ parses with a null variable
✅ parses with an object variable
✅ parses with an object variable having a toQuery property
✅ parses with an array variable
✅ parses with multiple variables
✅ parses nested expressions
✅ parses deep nested expressions
✅ parses with FQL string interpolation
✅ tests/unit/query.test.ts
query
✅ throws an [Function AuthorizationError] on a 403
✅ throws an [Function QueryTimeoutError] on a 440
✅ throws an [Function ServiceError] on a 999
✅ throws an [Function ThrottlingError] on a 429
✅ throws an [Function ServiceInternalError] on a 500
✅ throws an [Function QueryTimeoutError] on a 503
✅ Includes a summary when not present in error field but present at top-level
✅ Includes a summary when not present in error field but present at top-level
✅ Includes a summary when not present in error field but present at top-level
✅ Includes a summary when not present in error field but present at top-level
✅ Includes a summary when not present in error field but present at top-level
✅ Includes a summary when not present in error field but present at top-level
✅ retries throttling errors and then succeeds
✅ Includes a summary in a QueryResult when present at top-level
✅ Throws ProtocolError on an empty 200 response
✅ tests/unit/retryable.test.ts
retryable
✅ should retry
✅ should throw the last error if attempts are greater than or equal to maxAttempts
✅ should not retry if shouldRetry returns false
✅ should backoff
✅ tests/unit/set.test.ts
Page
✅ can be constructed directly
✅ after is optional
Embedded Set
✅ can be constructed directly
SetIterator
✅ can be constructed from a Page
✅ can be constructed from an EmbeddedSet
✅ can be constructed with an initial thunk for a T
✅ can be constructed with an initial thunk for a Page<T>
✅ can be constructed with an initial thunk for an EmbeddedSet
✅ can be flattened
✅ can flatten a Page
✅ throws if data and after are both undefined
✅ tests/unit/tagged-format.test.ts
tagged format with long_type number
✅ can be decoded
✅ can be encoded
✅ can be encoded as interpolation query
✅ handles conflicts
✅ handles conflicts in interpolation queries
✅ handles nested conflict types
✅ handles nested conflict types in interpolation queries
✅ wraps user-provided `@` fields
✅ Properly encodes and decodes number -(2**63)
✅ Properly encodes and decodes number -(2**53)
✅ Properly encodes and decodes number -(2**53 - 1)
✅ Properly encodes and decodes number -(2**31) - 1
✅ Properly encodes and decodes number -(2**31)
✅ Properly encodes and decodes number 0 (Int)
✅ Properly encodes and decodes number 1 (Int)
✅ Properly encodes and decodes number 0 (Long)
✅ Properly encodes and decodes number 2**31 - 1
✅ Properly encodes and decodes number 2**31
✅ Properly encodes and decodes number 2**53 - 1
✅ Properly encodes and decodes number 2**53
✅ Properly encodes and decodes number 2**64 - 1
✅ Properly encodes and decodes number 1.3**63
✅ Properly encodes and decodes number 1.3
✅ Properly encodes and decodes number 0.000000008
✅ Throws if BigInt value is lower than -(2**63) - 1
✅ Throws if BigInt value is greater than 2**63
✅ Throws if BigInt value is NEGATIVE_INFINITY
✅ Throws if BigInt value is POSITIVE_INFINITY
tagged format with long_type bigint
✅ can be decoded
✅ can be encoded
✅ can be encoded as interpolation query
✅ handles conflicts
✅ handles conflicts in interpolation queries
✅ handles nested conflict types
✅ handles nested conflict types in interpolation queries
✅ wraps user-provided `@` fields
✅ Properly encodes and decodes number -(2**63)
✅ Properly encodes and decodes number -(2**53)
✅ Properly encodes and decodes number -(2**53 - 1)
✅ Properly encodes and decodes number -(2**31) - 1
✅ Properly encodes and decodes number -(2**31)
✅ Properly encodes and decodes number 0 (Int)
✅ Properly encodes and decodes number 1 (Int)
✅ Properly encodes and decodes number 0 (Long)
✅ Properly encodes and decodes number 2**31 - 1
✅ Properly encodes and decodes number 2**31
✅ Properly encodes and decodes number 2**53 - 1
✅ Properly encodes and decodes number 2**53
✅ Properly encodes and decodes number 2**64 - 1
✅ Properly encodes and decodes number 1.3**63
✅ Properly encodes and decodes number 1.3
✅ Properly encodes and decodes number 0.000000008
✅ Throws if BigInt value is lower than -(2**63) - 1
✅ Throws if BigInt value is greater than 2**63
✅ Throws if BigInt value is NEGATIVE_INFINITY
✅ Throws if BigInt value is POSITIVE_INFINITY
Loading