association options
✓ can specify data type for auto-generated relational keys (80ms)
✓ should throw an error if foreignKey and as result in a name clash
✓ should throw an error if an association clashes with the name of an already define attribute
allows the user to provide an attribute definition object as foreignKey
✓ works with a column that hasnt been defined before
✓ works when taking a column directly from the object
✓ works when merging with an existing definition
Eager loading
✓ should load with an alias (63ms)
✓ should load all (57ms)
[MYSQL] HasMany
Model.associations
✓ should store all assocations when associting to the same table multiple times
count
✔ where complex with or + and (73ms)
✓ should not fail due to ambiguous field (70ms)
get
multiple
✓ should fetch associations for multiple instances (63ms)
✓ should fetch associations for multiple instances with limit and order (62ms)
✓ should fetch multiple layers of associations with limit and order with separate=true (103ms)
✓ should fetch associations for multiple instances with limit and order and a belongsTo relation (102ms)
✓ supports schemas (107ms)
(1:N)
✓ clears associations when passing null to the set-method with omitNull set to true (64ms)
hasAssociation
✓ should only generate one set of foreignKeys
✓ supports transactions (139ms)
✓ does not have any labels assigned to it initially
✓ answers true if the label has been assigned
✓ answers correctly if the label has been assigned when passing a primary key instead of an object
hasAssociations
✓ supports transactions (126ms)
✔ where relations with operators (104ms)
PASS src/__tests__/integration/tidb/runtime.test.ts (22.336 s)
Test Suites: 2 passed, 2 total
Tests: 130 passed, 130 total
Snapshots: 130 passed, 130 total
Time: 42.733 s
prisma-4.16.x end
[Pipeline] }
Cache not saved (ws/jenkins-pingcap-tidb-merged_integration_nodejs_test-4664/tidb-test already exists)
[Pipeline] // cache
[Pipeline] }
✓ answers false if only some labels have been assigned
✓ answers false if only some labels have been assigned when passing a primary key instead of an object
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
✓ answers true if all label have been assigned
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
✓ answers true if all label have been assigned when passing a primary key instead of an object
setAssociations
✓ supports transactions (71ms)
[Pipeline] }
✔ should not apply inner join if all conditions return undefined (67ms)
✓ clears associations when passing null to the set-method (74ms)
✓ supports passing the primary key instead of an object (77ms)
addAssociations
✓ supports transactions (71ms)
✓ supports passing the primary key instead of an object (69ms)
addMultipleAssociations
✓ adds associations without removing the current ones (75ms)
✓ handles decent sized bulk creates (163ms)
createAssociations
✓ creates a new associated object (69ms)
✓ creates the object with the association directly (67ms)
✔ should apply inner join if true is applied (64ms)
find options > where
✓ supports transactions (69ms)
✔ should skip undefined properties
✓ supports passing the field option (67ms)
getting assocations with options
✔ should skip null properties
find options > opaque-types-over-primitives
✔ should work in select
✓ should treat the where object of associations as a first class citizen (211ms)
✔ should work in where
✔ should work in order by
indices > basic unique index test
unique index
✔ should work without errors
indices > conditional index
✔ should correctly create conditional indices with WHERE condition
✔ should correctly drop conditional indices and revert drop
indices > embeds index test
embeddeds index
✔ should work without errors
indices > fulltext index
1) "before all" hook for "should correctly create fulltext indices"
2) "after all" hook for "with ngram parser"
396 passing (2m)
20 pending
2 failing
1) indices > fulltext index
"before all" hook for "should correctly create fulltext indices":
QueryFailedError: UNKNOWN_CODE_PLEASE_REPORT: Unsupported parser 'ngram'
at Query.<anonymous> (src/driver/mysql/MysqlQueryRunner.ts:222:33)
at Query.<anonymous> (node_modules/mysql/lib/Connection.js:526:10)
at Query._callback (node_modules/mysql/lib/Connection.js:488:16)
at Query.Sequence.end (node_modules/mysql/lib/protocol/sequences/Sequence.js:83:24)
at Query.ErrorPacket (node_modules/mysql/lib/protocol/sequences/Query.js:92:8)
at Protocol._parsePacket (node_modules/mysql/lib/protocol/Protocol.js:291:23)
at Parser._parsePacket (node_modules/mysql/lib/protocol/Parser.js:433:10)
at Parser.write (node_modules/mysql/lib/protocol/Parser.js:43:10)
at Protocol.write (node_modules/mysql/lib/protocol/Protocol.js:38:16)
at Socket.<anonymous> (node_modules/mysql/lib/Connection.js:88:28)
at Socket.<anonymous> (node_modules/mysql/lib/Connection.js:526:10)
at Socket.emit (node:events:513:28)
at addChunk (node:internal/streams/readable:324:12)
at readableAddChunk (node:internal/streams/readable:297:9)
at Socket.Readable.push (node:internal/streams/readable:234:10)
at TCP.onStreamRead (node:internal/stream_base_commons:190:23)
2) indices > fulltext index
"after all" hook for "with ngram parser":
TypeError: Cannot read properties of undefined (reading 'map')
at closeTestingConnections (test/utils/test-utils.ts:483:21)
at Context.<anonymous> (test/functional/indices/fulltext-index-test/fulltext-index-test.ts:22:40)
at processImmediate (node:internal/timers:471:21)
✓ gets all associated objects when no options are passed
✓ only get objects that fulfill the options
typeorm-0.3.17 end
=========== ERROR EXIT [2]: FULL tidb.log BEGIN ============
[2025/12/13 23:47:26.769 +00:00] [INFO] [printer.go:54] ["Welcome to TiDB."] ["Release Version"=v9.0.0-beta.2.pre-891-gc0659c1643-dirty] [Edition=Community] ["Git Commit Hash"=c0659c164366528cf5e9d6bb98ee8d22232a3863] ["Git Branch"=HEAD] ["UTC Build Time"="2025-12-13 23:41:46"] [GoVersion=go1.25.5] ["Race Enabled"=false] ["Check Table Before Drop"=false] ["Kernel Type"=Classic]
[2025/12/13 23:47:26.769 +00:00] [INFO] [cgmon.go:132] ["set the maxprocs"] [quota=6]
[2025/12/13 23:47:26.769 +00:00] [INFO] [cgmon.go:155] ["set the memory limit"] [memLimit=17179869184]
[2025/12/13 23:47:26.770 +00:00] [INFO] [printer.go:59] ["loaded config"] [config="{\"host\":\"0.0.0.0\",\"advertise-address\":\"10.233.66.121\",\"port\":4001,\"cors\":\"\",\"store\":\"tikv\",\"path\":\"127.0.0.1:2379\",\"socket\":\"\",\"lease\":\"0\",\"split-table\":false,\"token-limit\":1000,\"temp-dir\":\"/tmp/tidb\",\"tmp-storage-path\":\"/tmp/0_tidb/MC4wLjAuMDo0MDAxLzAuMC4wLjA6OTA4MQ==/tmp-storage\",\"tmp-storage-quota\":-1,\"server-version\":\"\",\"version-comment\":\"\",\"tidb-edition\":\"\",\"tidb-release-version\":\"\",\"keyspace-name\":\"\",\"tikv-worker-url\":\"\",\"log\":{\"level\":\"error\",\"format\":\"text\",\"disable-timestamp\":null,\"enable-timestamp\":null,\"disable-error-stack\":null,\"enable-error-stack\":null,\"file\":{\"filename\":\"\",\"max-size\":300,\"max-days\":0,\"max-backups\":0,\"compression\":\"\",\"is-buffered\":false,\"buffer-size\":0,\"buffer-flush-interval\":0},\"slow-query-file\":\"tidb-slow.log\",\"expensive-threshold\":10000,\"general-log-file\":\"\",\"query-log-max-len\":4096,\"enable-slow-log\":true,\"slow-threshold\":300,\"record-plan-in-slow-log\":1,\"timeout\":0},\"instance\":{\"tidb_general_log\":false,\"tidb_pprof_sql_cpu\":false,\"ddl_slow_threshold\":300,\"tidb_expensive_query_time_threshold\":60,\"tidb_expensive_txn_time_threshold\":600,\"tidb_stmt_summary_enable_persistent\":false,\"tidb_stmt_summary_filename\":\"tidb-statements.log\",\"tidb_stmt_summary_file_max_days\":3,\"tidb_stmt_summary_file_max_size\":64,\"tidb_stmt_summary_file_max_backups\":0,\"tidb_stmt_summary_max_stmt_count\":0,\"tidb_server_memory_limit\":\"\",\"tidb_mem_arbitrator_mode\":\"\",\"tidb_mem_arbitrator_soft_limit\":\"\",\"tidb_server_memory_limit_gc_trigger\":\"\",\"tidb_instance_plan_cache_max_size\":\"\",\"tidb_stats_cache_mem_quota\":0,\"tidb_mem_quota_binding_cache\":0,\"tidb_schema_cache_size\":\"\",\"tidb_enable_slow_log\":true,\"tidb_slow_log_threshold\":300,\"tidb_record_plan_in_slow_log\":1,\"tidb_check_mb4_value_in_utf8\":true,\"tidb_force_priority\":\"NO_PRIORITY\",\"tidb_memory_usage_alarm_ratio\":0.8,\"tidb_enable_collect_execution_info\":true,\"plugin_dir\":\"/data/deploy/plugin\",\"plugin_load\":\"\",\"plugin_audit_log_buffer_size\":0,\"plugin_audit_log_flush_interval\":30,\"max_connections\":0,\"tidb_enable_ddl\":true,\"tidb_enable_stats_owner\":true,\"tidb_rc_read_check_ts\":false,\"tidb_service_scope\":\"\"},\"security\":{\"skip-grant-table\":false,\"ssl-ca\":\"\",\"ssl-cert\":\"\",\"ssl-key\":\"\",\"cluster-ssl-ca\":\"\",\"cluster-ssl-cert\":\"\",\"cluster-ssl-key\":\"\",\"cluster-verify-cn\":null,\"session-token-signing-cert\":\"\",\"session-token-signing-key\":\"\",\"spilled-file-encryption-method\":\"plaintext\",\"enable-sem\":false,\"sem-config\":\"\",\"auto-tls\":false,\"tls-version\":\"\",\"rsa-key-size\":4096,\"secure-bootstrap\":false,\"auth-token-jwks\":\"\",\"auth-token-refresh-interval\":\"1h0m0s\",\"disconnect-on-expired-password\":true},\"status\":{\"status-host\":\"0.0.0.0\",\"metrics-addr\":\"\",\"status-port\":9081,\"metrics-interval\":15,\"report-status\":true,\"record-db-qps\":false,\"record-db-label\":false,\"grpc-keepalive-time\":10,\"grpc-keepalive-timeout\":3,\"grpc-concurrent-streams\":1024,\"grpc-initial-window-size\":2097152,\"grpc-max-send-msg-size\":2147483647},\"performance\":{\"max-procs\":0,\"max-memory\":0,\"server-memory-quota\":0,\"stats-lease\":\"0\",\"stmt-count-limit\":5000,\"pseudo-estimate-ratio\":0.8,\"bind-info-lease\":\"3s\",\"txn-entry-size-limit\":6291456,\"txn-total-size-limit\":104857600,\"tcp-keep-alive\":true,\"tcp-no-delay\":true,\"cross-join\":true,\"distinct-agg-push-down\":false,\"max-txn-ttl\":3600000,\"index-usage-sync-lease\":\"\",\"plan-replayer-gc-lease\":\"10m\",\"gogc\":100,\"enforce-mpp\":false,\"stats-load-concurrency\":0,\"stats-load-queue-size\":1000,\"analyze-partition-concurrency-quota\":16,\"plan-replayer-dump-worker-concurrency\":1,\"enable-stats-cache-mem-quota\":true,\"committer-concurrency\":128,\"run-auto-analyze\":true,\"force-priority\":\"NO_PRIORITY\",\"memory-usage-alarm-ratio\":0.8,\"enable-load-fmsketch\":false,\"skip-init-stats\":false,\"lite-init-stats\":true,\"force-init-stats\":true,\"concurrently-init-stats\":true,\"projection-push-down\":true,\"enable-async-batch-get\":true},\"prepared-plan-cache\":{\"enabled\":true,\"capacity\":100,\"memory-guard-ratio\":0.1},\"opentracing\":{\"enable\":false,\"rpc-metrics\":false,\"sampler\":{\"type\":\"const\",\"param\":1,\"sampling-server-url\":\"\",\"max-operations\":0,\"sampling-refresh-interval\":0},\"reporter\":{\"queue-size\":0,\"buffer-flush-interval\":0,\"log-spans\":false,\"local-agent-host-port\":\"\"}},\"proxy-protocol\":{\"networks\":\"\",\"header-timeout\":5,\"fallbackable\":true},\"pd-client\":{\"pd-server-timeout\":3},\"tikv-client\":{\"grpc-connection-count\":4,\"grpc-keepalive-time\":10,\"grpc-keepalive-timeout\":3,\"grpc-compression-type\":\"none\",\"grpc-shared-buffer-pool\":false,\"grpc-initial-window-size\":134217728,\"grpc-initial-conn-window-size\":134217728,\"commit-timeout\":\"41s\",\"async-commit\":{\"keys-limit\":256,\"total-key-size-limit\":4096,\"safe-window\":2000000000,\"allowed-clock-drift\":500000000},\"batch-policy\":\"standard\",\"max-batch-size\":128,\"overload-threshold\":200,\"max-batch-wait-time\":0,\"batch-wait-size\":8,\"enable-chunk-rpc\":true,\"region-cache-ttl\":600,\"store-limit\":0,\"store-liveness-timeout\":\"1s\",\"copr-cache\":{\"capacity-mb\":1000},\"copr-req-timeout\":60000000000,\"ttl-refreshed-txn-size\":33554432,\"resolve-lock-lite-threshold\":16,\"max-concurrency-request-limit\":9223372036854775807,\"enable-replica-selector-v2\":true},\"compatible-kill-query\":false,\"pessimistic-txn\":{\"max-retry-count\":256,\"deadlock-history-capacity\":10,\"deadlock-history-collect-retryable\":false,\"pessimistic-auto-commit\":false,\"constraint-check-in-place-pessimistic\":true},\"max-index-length\":3072,\"index-limit\":64,\"table-column-count-limit\":1017,\"graceful-wait-before-shutdown\":0,\"alter-primary-key\":false,\"treat-old-version-utf8-as-utf8mb4\":true,\"enable-table-lock\":false,\"delay-clean-table-lock\":0,\"split-region-max-num\":1000,\"top-sql\":{\"receiver-address\":\"\"},\"repair-mode\":false,\"repair-table-list\":[],\"isolation-read\":{\"engines\":[\"tikv\",\"tiflash\",\"tidb\"]},\"new_collations_enabled_on_first_bootstrap\":true,\"experimental\":{\"allow-expression-index\":false},\"skip-register-to-dashboard\":false,\"enable-telemetry\":false,\"labels\":{},\"enable-global-index\":false,\"deprecate-integer-display-length\":false,\"enable-enum-length-limit\":true,\"stores-refresh-interval\":60,\"enable-tcp4-only\":false,\"enable-forwarding\":false,\"max-ballast-object-size\":0,\"ballast-object-size\":0,\"transaction-summary\":{\"transaction-summary-capacity\":500,\"transaction-id-digest-min-duration\":2147483647},\"enable-global-kill\":true,\"enable-32bits-connection-id\":true,\"initialize-sql-file\":\"\",\"standby\":{\"standby-mode\":false,\"max-idle-seconds\":0,\"activation-timeout\":0,\"enable-zero-backend\":false},\"enable-batch-dml\":false,\"mem-quota-query\":1073741824,\"oom-action\":\"cancel\",\"oom-use-tmp-storage\":true,\"check-mb4-value-in-utf8\":true,\"enable-collect-execution-info\":true,\"plugin\":{\"dir\":\"/data/deploy/plugin\",\"load\":\"\"},\"max-server-connections\":0,\"run-ddl\":true,\"disaggregated-tiflash\":false,\"autoscaler-type\":\"aws\",\"autoscaler-addr\":\"tiflash-autoscale-lb.tiflash-autoscale.svc.cluster.local:8081\",\"is-tiflashcompute-fixed-pool\":false,\"autoscaler-cluster-id\":\"\",\"use-autoscaler\":false,\"tidb-max-reuse-chunk\":64,\"tidb-max-reuse-column\":256,\"tidb-enable-exit-check\":false,\"in-mem-slow-query-topn-num\":30,\"in-mem-slow-query-recent-num\":500,\"metering-storage-uri\":\"\"}"]
=========== ERROR EXIT [2]: FULL tidb.log END ==============
[Pipeline] }
Cache not saved (inner-step execution failed)
[Pipeline] // cache
[Pipeline] }
[Pipeline] // dir
Post stage
[Pipeline] script
[Pipeline] {
countAssociations
✓ should count all associations
[Pipeline] echo
Test failed, archive the log
[Pipeline] }
[Pipeline] // script
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
✓ should count filtered associations
[Pipeline] // container
[Pipeline] }
[Pipeline] // withEnv
✓ should count scoped associations
thisAssociations
✓ should work with alias
[Pipeline] }
foreign key constraints
1:m
✓ sets null by default (71ms)
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] }
✓ sets to CASCADE if allowNull: false (73ms)
✓ should be possible to remove all constraints (64ms)
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
Failed in branch Matrix - TEST_DIR = 'typeorm_test'
✓ can cascade deletes (71ms)
✓ can cascade updates (79ms)
✓ can restrict deletes (77ms)
✓ can restrict updates (79ms)
Association options
✓ should setup underscored field with foreign keys when using underscored
✓ should use model name when using camelcase
✓ can specify data type for auto-generated relational keys (81ms)
✓ infers the keyType if none provided (73ms)
✓ should throw an error if foreignKey and as result in a name clash
(node:752) [SEQUELIZE0005] DeprecationWarning: Passing a double nested nested array to `group` is unsupported and will be removed in v6.
(Use `node --trace-deprecation ...` to show where the warning was created)
✓ should ignore group from ancestor on deep separated query (133ms)
allows the user to provide an attribute definition object as foreignKey
✓ works with a column that hasnt been defined before
✓ works when taking a column directly from the object
✓ works when merging with an existing definition
sourceKey
✓ should use sourceKey
✓ should count related records
✓ should set right field when add relative
✓ should create with nested associated models
✓ should create nested associations with symmetric getters/setters on FK (322ms)
sourceKey with where clause in include
✓ should use the specified sourceKey instead of the primary key
Eager loading
✓ should load with an alias (75ms)
✓ should load all (71ms)
[MYSQL] HasOne
Model.associations
✓ should store all associations when associating to the same table multiple times
get
multiple
✓ should fetch associations for multiple instances (75ms)
getAssociation
✓ supports transactions (85ms)
✓ should be able to handle a where object that's a first class citizen. (76ms)
✓ supports schemas (80ms)
setAssociation
✓ supports transactions (72ms)
✓ can set an association with predefined primary keys (72ms)
✓ clears the association if null is passed (67ms)
✓ should throw a ForeignKeyConstraintError if the associated record does not exist (62ms)
✓ supports passing the primary key instead of an object (78ms)
✓ supports updating with a primary key instead of an object (79ms)
✓ supports setting same association twice (78ms)
createAssociation
✓ creates an associated model instance (71ms)
✓ supports transactions (75ms)
foreign key
✓ should setup underscored field with foreign keys when using underscored
✓ should use model name when using camelcase
✓ should support specifying the field of a foreign key (71ms)
✓ should support custom primary key field name in sub queries (64ms)
foreign key constraints
✓ are enabled by default (65ms)
✓ sets to CASCADE if allowNull: false (64ms)
✓ should be possible to disable them (62ms)
✓ can cascade deletes (65ms)
✓ works when cascading a delete with hooks but there is no associate (i.e. "has zero") (57ms)
✓ can cascade updates (64ms)
✓ can restrict deletes (69ms)
✓ can restrict updates (73ms)
association column
✓ has correct type for non-id primary keys with non-integer type (56ms)
✓ should support a non-primary key as the association column on a target with custom primary key (70ms)
✓ should support a non-primary unique key as the association column (71ms)
✓ should support a non-primary unique key as the association column with a field option (70ms)
Association options
✓ can specify data type for autogenerated relational keys
✓ should throw an error if an association clashes with the name of an already define attribute
allows the user to provide an attribute definition object as foreignKey
✓ works with a column that hasnt been defined before
✓ works when taking a column directly from the object
✓ works when merging with an existing definition
Counter part
BelongsTo
✓ should only generate one foreign key
Eager loading
✓ should load with an alias (71ms)
✓ should load all (74ms)
[MYSQL] Multiple Level Filters
✓ can filter through belongsTo (128ms)
✓ avoids duplicated tables in query (120ms)
✓ can filter through hasMany (118ms)
✓ can filter through hasMany connector (100ms)
[MYSQL] associations
scope
1:1
✓ should create, find and include associations with scope values (117ms)
✓ should create included association with scope values (120ms)
1:M
✓ should create, find and include associations with scope values (122ms)
✓ should make the same query if called multiple time (#4470) (111ms)
✓ should created included association with scope values (110ms)
✓ should include associations with operator scope values (126ms)
✓ should not mutate scope when running SELECT query (#12868) (108ms)
N:M
on the target
✓ [Flaky] should create, find and include associations with scope values (95ms)
on the through model
✓ should create, find and include associations with scope values (102ms)
[MYSQL] Self
✓ supports freezeTableName
✓ can handle 1:m associations (43ms)
✓ can handle n:m associations (74ms)
✓ can handle n:m associations with pre-defined through table (71ms)
[MYSQL] CLS (Async hooks)
✓ CLS namespace is stored in Sequelize._cls
✓ promises returned by sequelize.query are correctly patched
✓ custom logging with benchmarking has correct CLS context (503ms)
context
✓ does not use continuation storage on manually managed transactions
✓ supports several concurrent transactions
✓ supports nested promise chains
✓ does not leak variables to the outer scope (502ms)
✓ does not leak variables to the following promise chain
✓ does not leak outside findOrCreate
sequelize.query integration
✓ automagically uses the transaction in all calls
✓ automagically uses the transaction in all calls with async/await
Model Hook integration
✓ passes the transaction to hooks {beforeBulkCreate,beforeCreate,afterCreate,afterBulkCreate} when calling Model.bulkCreate
✓ passes the transaction to hooks {beforeFind,beforeFindAfterExpandIncludeAll,beforeFindAfterOptions} when calling Model.findAll
✓ passes the transaction to hooks {afterFind} when calling Model.findAll
✓ passes the transaction to hooks {beforeCount} when calling Model.count
✓ passes the transaction to hooks {beforeUpsert,afterUpsert} when calling Model.upsert
✓ passes the transaction to hooks {beforeBulkDestroy,afterBulkDestroy} when calling Model.destroy
✓ passes the transaction to hooks {beforeDestroy,beforeDestroy} when calling Model.destroy with individualHooks
✓ passes the transaction to hooks {beforeDestroy,beforeDestroy} when calling Model#destroy
✓ passes the transaction to hooks {beforeBulkUpdate,afterBulkUpdate} when calling Model.update
✓ passes the transaction to hooks {beforeUpdate,afterUpdate} when calling Model.update with individualHooks
✓ passes the transaction to hooks {beforeCreate,afterCreate} when calling Model#save (isNewRecord)
✓ passes the transaction to hooks {beforeUpdate,afterUpdate} when calling Model#save (!isNewRecord)
paranoid restore
✓ passes the transaction to hooks {beforeBulkRestore,afterBulkRestore} when calling Model.restore
✓ passes the transaction to hooks {beforeRestore,afterRestore} when calling Model.restore with individualHooks
✓ passes the transaction to hooks {beforeRestore,afterRestore} when calling Model#restore
[MYSQL] Configuration
Connections problems should fail with a nice message
✓ when we don't have the correct server details
✓ when we don't have the correct login information
✓ when we don't have a valid dialect.
[MYSQL] DataTypes
✓ allows me to return values from a custom parse function
✓ calls parse and stringify for JSON (39ms)
✓ calls parse and stringify for DATE (41ms)
✓ calls parse and stringify for DATEONLY (44ms)
✓ calls parse and stringify for TIME
✓ calls parse and stringify for BLOB
✓ calls parse and stringify for CHAR
✓ calls parse and stringify/bindParam for STRING
✓ calls parse and stringify for TEXT
✓ calls parse and stringify for BOOLEAN
✓ calls parse and stringify for INTEGER (43ms)
✓ calls parse and stringify for DECIMAL (39ms)
✓ calls parse and stringify for BIGINT (44ms)
✓ should handle JS BigInt type (45ms)
✓ should handle TINYINT booleans (51ms)
✓ calls parse and bindParam for DOUBLE (42ms)
✓ calls parse and bindParam for FLOAT (45ms)
✓ calls parse and bindParam for REAL (39ms)
✓ calls parse and stringify for UUID
✓ calls parse and stringify for CIDR
✓ calls parse and stringify for INET
✓ calls parse and stringify for CITEXT
✓ calls parse and stringify for MACADDR
✓ calls parse and stringify for ENUM
✓ should parse DECIMAL as string
✓ should parse BIGINT as string
✓ should allow spaces in ENUM (39ms)
✓ should return YYYY-MM-DD format string for DATEONLY (51ms)
✓ should return set DATEONLY field to NULL correctly (42ms)
✓ should be able to cast buffer as boolean
[MYSQL] Connection Manager
✓ should initialize a single pool without replication
✓ should initialize a multiple pools with replication
✓ should round robin calls to the read pool
✓ should trigger deprecation for non supported engine version
✓ should allow forced reads from the write pool
✓ should clear the pool after draining it
[MYSQL Specific] Associations
many-to-many
where tables have the same prefix
✓ should create a table wp_table1wp_table2s (46ms)
when join table name is specified
✓ should not use only a specified name
HasMany
addDAO / getModel
✓ should correctly add an association to the dao
removeDAO
✓ should correctly remove associated objects
[MYSQL Specific] Connection Manager
✓ -FOUND_ROWS can be suppressed to get back legacy behavior
✓ should acquire a valid connection when keepDefaultTimezone is true
[MYSQL Specific] DAOFactory
constructor
✓ handles extended attributes (unique)
✓ handles extended attributes (default)
✓ handles extended attributes (null)
✓ handles extended attributes (primaryKey)
✓ adds timestamps
✓ adds deletedAt if paranoid
✓ underscores timestamps if underscored
✓ omits text fields with defaultValues
✓ omits blobs fields with defaultValues
primaryKeys
✓ determines the correct primaryKeys
[MYSQL Specific] Errors
ForeignKeyConstraintError
✓ in context of DELETE restriction (112ms)
✓ in context of missing relation (116ms)
[MYSQL] Warning
logging
Executing (default): DROP TABLE IF EXISTS `models`;
Executing (default): SHOW WARNINGS
MySQL Warnings (default): Unknown table 'sequelize_test.models'; Unknown table 'sequelize_test.models'
Executing (default): SELECT CONSTRAINT_NAME as constraint_name,CONSTRAINT_NAME as constraintName,CONSTRAINT_SCHEMA as constraintSchema,CONSTRAINT_SCHEMA as constraintCatalog,TABLE_NAME as tableName,TABLE_SCHEMA as tableSchema,TABLE_SCHEMA as tableCatalog,COLUMN_NAME as columnName,REFERENCED_TABLE_SCHEMA as referencedTableSchema,REFERENCED_TABLE_SCHEMA as referencedTableCatalog,REFERENCED_TABLE_NAME as referencedTableName,REFERENCED_COLUMN_NAME as referencedColumnName FROM INFORMATION_SCHEMA.KEY_COLUMN_USAGE where TABLE_NAME = 'models' AND CONSTRAINT_NAME!='PRIMARY' AND CONSTRAINT_SCHEMA='sequelize_test' AND REFERENCED_TABLE_NAME IS NOT NULL;
Executing (default): DROP TABLE IF EXISTS `models`;
Executing (default): SHOW WARNINGS
MySQL Warnings (default): Unknown table 'sequelize_test.models'; Unknown table 'sequelize_test.models'
Executing (default): DROP TABLE IF EXISTS `models`;
Executing (default): SHOW WARNINGS
MySQL Warnings (default): Unknown table 'sequelize_test.models'; Unknown table 'sequelize_test.models'
Executing (default): CREATE TABLE IF NOT EXISTS `models` (`id` INTEGER NOT NULL auto_increment , `name` VARCHAR(1) BINARY, `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `models`
Executing (default): SELECT 1+1 AS result
Executing (default): SET SESSION sql_mode='';
Executing (default): INSERT INTO `models` (`id`,`name`,`createdAt`,`updatedAt`) VALUES (DEFAULT,?,?,?);
Executing (default): SHOW WARNINGS
MySQL Warnings (default):
✓ logs warnings when there are warnings
[MYSQL] Sequelize Errors
API Surface
✓ Should have the Error constructors exposed
✓ Sequelize Errors instances should be instances of Error
✓ SequelizeValidationError should find errors by path
✓ SequelizeValidationError should override message property when message parameter is specified
✓ SequelizeValidationError should concatenate an error messages from given errors if no explicit message is defined
✓ SequelizeValidationErrorItem does not require instance & validator constructor parameters
✓ SequelizeValidationErrorItem should have instance, key & validator properties when given to constructor
✓ SequelizeValidationErrorItem.getValidatorKey() should return a string
✓ SequelizeValidationErrorItem.getValidatorKey() should throw if namespace separator is invalid (only if NS is used & available)
✓ SequelizeValidationErrorItem should map deprecated "type" values to new "origin" values
✓ SequelizeValidationErrorItemOrigin is valid
✓ SequelizeValidationErrorItem.Origins is valid
✓ SequelizeDatabaseError should keep original message
✓ SequelizeDatabaseError should keep the original sql and the parameters
✓ ConnectionError should keep original message
✓ ConnectionRefusedError should keep original message
✓ AccessDeniedError should keep original message
✓ HostNotFoundError should keep original message
✓ HostNotReachableError should keep original message
✓ InvalidConnectionError should keep original message
✓ ConnectionTimedOutError should keep original message
OptimisticLockError
✓ got correct error type and message
ConstraintError
✓ Can be intercepted as UniqueConstraintError using .catch (39ms)
✓ Can be intercepted as ValidationError using .catch (42ms)
✓ Supports newlines in keys (42ms)
✓ Works when unique keys are not defined in sequelize (46ms)
✓ adds parent and sql properties (39ms)
[MYSQL] Hooks
associations
1:1
cascade onUpdate
✓ on success
✓ on error
cascade onDelete
#remove
✓ with no errors
✓ with errors
no cascade update
✓ on success
✓ on error
no cascade delete
#remove
✓ with no errors
✓ with errors
1:M
cascade
#remove
✓ with no errors
✓ with errors
no cascade
#remove
✓ with no errors
✓ with errors
M:M
cascade
#remove
✓ with no errors
✓ with errors
no cascade
#remove
✓ with no errors
✓ with errors
multiple 1:M
cascade
#remove
✓ with no errors
✓ with errors
multiple 1:M sequential hooks
cascade
#remove
✓ with no errors
✓ with errors
[MYSQL] Hooks
#bulkCreate
on success
✓ should run hooks
on error
✓ should return an error from before
✓ should return an error from after
with the {individualHooks: true} option
✓ should run the afterCreate/beforeCreate functions for each item created successfully
✓ should run the afterCreate/beforeCreate functions for each item created with an error
#bulkUpdate
on success
✓ should run hooks
on error
✓ should return an error from before
✓ should return an error from after
with the {individualHooks: true} option
✓ should run the after/before functions for each item created successfully
✓ should run the after/before functions for each item created successfully changing some data before updating
✓ should run the after/before functions for each item created with an error
#bulkDestroy
on success
✓ should run hooks
on error
✓ should return an error from before
✓ should return an error from after
with the {individualHooks: true} option
✓ should run the after/before functions for each item created successfully
✓ should run the after/before functions for each item created with an error
#bulkRestore
on success
✓ should run hooks
on error
✓ should return an error from before
✓ should return an error from after
with the {individualHooks: true} option
✓ should run the after/before functions for each item restored successfully
✓ should run the after/before functions for each item restored with an error
[MYSQL] Hooks
#count
on success
✓ hook runs
✓ beforeCount hook can change options
on error
✓ in beforeCount hook returns error
[MYSQL] Hooks
#create
✓ should not trigger hooks on parent when using N:M association setters (179ms)
on success
✓ should run hooks
on error
✓ should return an error from before
✓ should return an error from after
preserves changes to instance
✓ beforeValidate
✓ afterValidate
✓ beforeCreate
✓ beforeSave
✓ beforeSave with beforeCreate
[MYSQL] Hooks
#destroy
on success
✓ should run hooks
on error
✓ should return an error from before
✓ should return an error from after
with paranoid mode enabled
✓ sets other changed values when soft deleting and a beforeDestroy hooks kicks in
✓ should not throw error when a beforeDestroy hook changes a virtual column
[MYSQL] Hooks
#find
✓ allow changing attributes via beforeFind #5675
on success
✓ all hooks run
✓ beforeFind hook can change options
✓ beforeFindAfterExpandIncludeAll hook can change options
✓ beforeFindAfterOptions hook can change options
✓ afterFind hook can change results
on error
✓ in beforeFind hook returns error
✓ in beforeFindAfterExpandIncludeAll hook returns error
✓ in beforeFindAfterOptions hook returns error
✓ in afterFind hook returns error
[MYSQL] Hooks
#define
✓ beforeDefine hook can change model name
✓ beforeDefine hook can alter options
✓ beforeDefine hook can alter attributes
✓ afterDefine hook can alter options
#init
✓ beforeInit hook can alter config
✓ beforeInit hook can alter options
✓ afterInit hook can alter options
passing DAO instances
beforeValidate / afterValidate
✓ should pass a DAO instance to the hook (73ms)
beforeCreate / afterCreate
✓ should pass a DAO instance to the hook (86ms)
beforeDestroy / afterDestroy
✓ should pass a DAO instance to the hook (69ms)
beforeUpdate / afterUpdate
✓ should pass a DAO instance to the hook (70ms)
Model#sync
on success
✓ should run hooks
✓ should not run hooks when "hooks = false" option passed
on error
✓ should return an error from before
✓ should return an error from after
sequelize#sync
on success
✓ should run hooks
✓ should not run hooks if "hooks = false" option passed
on error
✓ should return an error from before
✓ should return an error from after
#removal
✓ should be able to remove by name
✓ should be able to remove by reference
✓ should be able to remove proxies
Sequelize hooks
✓ should run before/afterPoolAcquire hooks
[MYSQL] Hooks
#restore
on success
✓ should run hooks
on error
✓ should return an error from before
✓ should return an error from after
[MYSQL] Hooks
#update
on success
✓ should run hooks
on error
✓ should return an error from before
✓ should return an error from after
preserves changes to instance
✓ beforeValidate
✓ afterValidate
✓ beforeSave
✓ beforeSave with beforeUpdate
[MYSQL] Hooks
#upsert
on success
✓ should run hooks
on error
✓ should return an error from before
✓ should return an error from after
preserves changes to values
✓ beforeUpsert
[MYSQL] Hooks
#validate
#create
✓ should return the user
#3534, hooks modifications
✓ fields modified in hooks are saved
on error
✓ should emit an error from after hook
✓ should call validationFailed hook
✓ should not replace the validation error in validationFailed hook by default
✓ should replace the validation error if validationFailed hook creates a new error
[MYSQL] Include
find
✓ should support an empty belongsTo include (64ms)
✓ should support a belongsTo association reference (74ms)
✓ should support to use associations with Sequelize.col (133ms)
✓ should support a belongsTo association reference with a where (77ms)
✓ should support a empty hasOne include (68ms)
✓ should support a hasOne association reference (73ms)
✓ should support including a belongsTo association rather than a model/as pair (72ms)
✓ should support a hasMany association reference (72ms)
✓ should support a hasMany association reference with a where condition (86ms)
✓ should support a belongsToMany association reference (101ms)
✓ should support a simple nested belongsTo -> belongsTo include (113ms)
✓ should support a simple sibling set of belongsTo include (93ms)
✓ should support a simple nested hasOne -> hasOne include (125ms)
✓ should support a simple nested hasMany -> belongsTo include (123ms)
✓ should support a simple nested belongsTo -> hasMany include (138ms)
✓ should support a simple nested hasMany to hasMany include (177ms)
✓ should support an include with multiple different association types (331ms)
✓ should support specifying attributes (67ms)
✓ should support Sequelize.literal and renaming of attributes in included model attributes (77ms)
✓ should support self associated hasMany (with through) include (70ms)
✓ should support including date fields, with the correct timeszone (109ms)
✓ should support include when retrieving associated objects (109ms)
where
✓ should support Sequelize.and()
✓ should support Sequelize.or()
findAndCountAll
✓ should include associations to findAndCountAll (84ms)
association getter
✓ should support getting an include on a N:M association getter (112ms)
right join
✓ should support getting an include with a right join (58ms)
✓ should support getting an include through with a right join (94ms)
nested includes
✓ should not ripple grandchild required to top level find when required of child is set to false
✓ should support eager loading associations using the name of the relation (string)
✓ should not ripple grandchild required to top level find when required of child is not given (implicitly false)
✓ should ripple grandchild required to top level find when required of child is set to true as well
[MYSQL] Include
findAll
✓ should work on a nested set of relations with a where condition in between relations (176ms)
✓ should accept nested `where` and `limit` at the same time (140ms)
✓ should support an include with multiple different association types (360ms)
✓ should support many levels of belongsTo (327ms)
✓ should support many levels of belongsTo (with a lower level having a where) (304ms)
✓ should support ordering with only belongsTo includes (101ms)
✓ should include attributes from through models (101ms)
✓ should support a required belongsTo include (73ms)
✓ should be possible to extend the on clause with a where option on a belongsTo include (78ms)
✓ should be possible to extend the on clause with a where option on a belongsTo include (66ms)
✓ should be possible to define a belongsTo include as required with child hasMany not required (110ms)
✓ should be possible to define a belongsTo include as required with child hasMany with limit (114ms)
✓ should be possible to define a belongsTo include as required with child hasMany with limit and aliases (132ms)
✓ should be possible to define a belongsTo include as required with child hasMany which is not required with limit (110ms)
✓ should be possible to extend the on clause with a where option on a hasOne include (74ms)
✓ should be possible to extend the on clause with a where option on a hasMany include with a through model (109ms)
✓ should be possible to extend the on clause with a where option on nested includes (313ms)
✓ should be possible to use limit and a where with a belongsTo include (72ms)
✓ should be possible use limit, attributes and a where on a belongsTo with additional hasMany includes (399ms)
✓ should be possible to have the primary key in attributes (83ms)
✓ should be possible to turn off the attributes for the through table (397ms)
✓ should be possible to select on columns inside a through table (412ms)
✓ should be possible to select on columns inside a through table and a limit (478ms)
✓ should be possible not to include the main id in the attributes (89ms)
✓ should be possible to use limit and a where on a hasMany with additional includes (1191ms)
✓ should be possible to use limit and a where on a hasMany with a through model with additional includes (493ms)
✓ should support including date fields, with the correct timeszone (104ms)
✓ should still pull the main record(s) when an included model is not required and has where restrictions without matches (118ms)
✓ should work with paranoid, a main record where, an include where, and a limit (76ms)
✓ should work on a nested set of required 1:1 relations (104ms)
✓ should work with an empty include.where (129ms)
✓ should be able to order on the main table and a required belongsTo relation with custom tablenames and limit (77ms)
✓ should ignore include with attributes: [] (used for aggregates) (74ms)
✓ should ignore include with attributes: [] and through: { attributes: [] } (used for aggregates) (118ms)
✓ should not add primary key when including and aggregating with raw: true (80ms)
✓ should return posts with nested include with inner join with a m:n association (216ms)
✓ should be able to generate a correct request with inner and outer join (147ms)
✓ should be able to generate a correct request for entity with 1:n and m:1 associations and limit (677ms)
✓ should allow through model to be paranoid (116ms)
[MYSQL] Include
findAndCountAll
✓ should be able to include two required models with a limit. Result rows should match limit. (96ms)
✓ should be able to include a required model. Result rows should match count (154ms)
✓ should count on a where and not use an uneeded include (68ms)
✓ should return the correct count and rows when using a required belongsTo and a limit (80ms)
✓ should return the correct count and rows when using a required belongsTo with a where condition and a limit (82ms)
✓ should correctly filter, limit and sort when multiple includes and types of associations are present. (203ms)
✓ should properly work with sequelize.function (76ms)
[MYSQL] Include
findOne
✓ should include a non required model, with conditions and two includes N:M 1:M (210ms)
✓ should work with a 1:M to M:1 relation with a where on the last include (101ms)
✓ should include a model with a where condition but no required (82ms)
✓ should include a model with a where clause when the PK field name and attribute name are different (75ms)
✓ should include a model with a through.where and required true clause when the PK field name and attribute name are different (113ms)
✓ should still pull the main record when an included model is not required and has where restrictions without matches (123ms)
✓ should support a nested include (with a where) (136ms)
✓ should support a belongsTo with the targetKey option (83ms)
✓ should support many levels of belongsTo (with a lower level having a where) (368ms)
✓ should work with combinding a where and a scope (71ms)
[MYSQL] Include
LIMIT
✓ supports many-to-many association with where clause (436ms)
✓ supports 2 levels of required many-to-many associations (455ms)
✓ supports 2 levels of required many-to-many associations with where clause (517ms)
✓ supports 2 levels of required many-to-many associations with through.where clause (413ms)
✓ supports 3 levels of required many-to-many associations with where clause (468ms)
✓ supports required many-to-many association (544ms)
✓ supports 2 required many-to-many association (525ms)
✓ supports required one-to-many association (505ms)
✓ supports required one-to-many association with where clause (433ms)
✓ supports required one-to-many association with where clause (findOne) (463ms)
✓ supports 2 levels of required one-to-many associations (555ms)
✓ supports required one-to-many association with nested required many-to-many association (482ms)
✓ supports required many-to-many association with nested required one-to-many association (493ms)
✓ supports required many-to-one association with nested many-to-many association with where clause (533ms)
✓ supports required many-to-one association with nested many-to-many association with through.where clause (540ms)
✓ supports required many-to-one association with multiple nested associations with where clause (466ms)
✓ supports required many-to-one association with nested one-to-many association with where clause (524ms)
[MYSQL] Paranoid
✓ paranoid with timestamps: false should be ignored / not crash (577ms)
✓ test if non required is marked as false
✓ test if required is marked as true
✓ should not load paranoid, destroyed instances, with a non-paranoid parent (518ms)
[MYSQL] Includes with schemas
findAll
✓ should support an include with multiple different association types (462ms)
✓ should support many levels of belongsTo (393ms)
✓ should support ordering with only belongsTo includes (109ms)
✓ should include attributes from through models (128ms)
✓ should support a required belongsTo include (81ms)
✓ should be possible to extend the on clause with a where option on a belongsTo include (84ms)
✓ should be possible to extend the on clause with a where option on a belongsTo include (108ms)
✓ should be possible to define a belongsTo include as required with child hasMany with limit (137ms)
✓ should be possible to define a belongsTo include as required with child hasMany with limit and aliases (133ms)
✓ should be possible to define a belongsTo include as required with child hasMany which is not required with limit (155ms)
✓ should be possible to extend the on clause with a where option on a hasOne include (100ms)
✓ should be possible to extend the on clause with a where option on a hasMany include with a through model (139ms)
✓ should be possible to extend the on clause with a where option on nested includes (445ms)
✓ should be possible to use limit and a where with a belongsTo include (97ms)
✓ should be possible use limit, attributes and a where on a belongsTo with additional hasMany includes (588ms)
✓ should be possible to use limit and a where on a hasMany with additional includes (531ms)
✓ should be possible to use limit and a where on a hasMany with a through model with additional includes (481ms)
✓ should support including date fields, with the correct timezone (210ms)
findOne
✓ should work with schemas (100ms)
[MYSQL] Include
separate
✓ should run a hasMany association in a separate query (103ms)
✓ should work even if the id was not included (90ms)
✓ should work even if include does not specify foreign key attribute with custom sourceKey (102ms)
✓ should not break a nested include with null values (177ms)
✓ should run a hasMany association with limit in a separate query (113ms)
✓ should run a nested (from a non-separate include) hasMany association in a separate query (160ms)
✓ should work having a separate include between a parent and child include (181ms)
✓ should run two nested hasMany association in a separate queries (154ms)
✓ should work with two schema models in a hasMany association (110ms)
✓ should work with required non-separate parent and required child (145ms)
[MYSQL] Instance
Escaping
✓ is done properly for special characters
isNewRecord
✓ returns true for non-saved objects
✓ returns false for saved objects
✓ returns false for created objects
✓ returns false for upserted objects
✓ returns false for objects found by find method
✓ returns false for objects found by findAll method
default values
uuid
✓ should store a string in uuidv1 and uuidv4
✓ should store a string of length 36 in uuidv1 and uuidv4
✓ should store a valid uuid in uuidv1 and uuidv4 that conforms to the UUID v1 and v4 specifications
✓ should store a valid uuid if the multiple primary key fields used
current date
✓ should store a date in touchedAt
✓ should store the current date in touchedAt
allowNull date
✓ should be just "null" and not Date with Invalid Date
✓ should be the same valid date when saving the date
super user boolean
✓ should default to false
✓ should override default when given truthy boolean
✓ should override default when given truthy boolean-string ("true")
✓ should override default when given truthy boolean-int (1)
✓ should throw error when given value of incorrect type
complete
✓ gets triggered if an error occurs
✓ gets triggered if everything was ok
findAll
✓ sql should have paranoid condition
✓ sequelize.and as where should include paranoid condition
✓ sequelize.or as where should include paranoid condition
✓ escapes a single single quotes properly in where clauses
✓ escapes two single quotes properly in where clauses
✓ returns the timestamps if no attributes have been specified
✓ does not return the timestamps if the username attribute has been specified
✓ creates the deletedAt property, when defining paranoid as true
✓ destroys a record with a primary key of something other than id (40ms)
✓ sets deletedAt property to a specific date when deleting an instance
✓ keeps the deletedAt-attribute with value null, when running update
✓ keeps the deletedAt-attribute with value null, when updating associations
✓ can reuse query option objects
findOne
✓ can reuse query option objects
✓ returns null for null, undefined, and unset boolean values (42ms)
equals
✓ can compare records with Date field
✓ does not compare the existence of associations (95ms)
values
✓ returns all values
isSoftDeleted
✓ should return false when model is just created
✓ returns false if user is not soft deleted
✓ returns true if user is soft deleted
✓ works with custom `deletedAt` field name (52ms)
restore
✓ returns an error if the model is not paranoid
✓ restores a previously deleted model (45ms)
✓ supports custom deletedAt field (45ms)
✓ supports custom deletedAt field name (43ms)
✓ supports custom deletedAt field and database column (39ms)
✓ supports custom default value (108ms)
[MYSQL] InstanceValidator
✓ correctly validates using custom validation methods
✓ supports promises with custom validation methods (45ms)
✓ skips other validations if allowNull is true and the value is null
✓ validates a model with custom model-wide validation methods
✓ validates model with a validator whose arg is an Array successfully twice in a row
✓ validates enums
✓ skips validations for the given fields
✓ skips validations for fields with value that is SequelizeMethod
✓ raises an error if saving a different value into an immutable field (47ms)
✓ allows setting an immutable field if the record is unsaved
✓ raises an error for array on a STRING
✓ raises an error for array on a STRING(20)
✓ raises an error for array on a TEXT
✓ raises an error for {} on a STRING
✓ raises an error for {} on a STRING(20)
✓ raises an error for {} on a TEXT
✓ does not raise an error for null on a STRING (where null is allowed)
✓ validates VIRTUAL fields
✓ allows me to add custom validation functions to validator.js
#update
✓ should allow us to update specific columns without tripping the validations (65ms)
✓ should be able to emit an error upon updating when a validation has failed from an instance (75ms)
✓ should be able to emit an error upon updating when a validation has failed from the factory (46ms)
✓ should enforce a unique constraint (121ms)
✓ should allow a custom unique constraint error message (56ms)
✓ should handle multiple unique messages correctly (102ms)
#create
generic
✓ correctly throws an error using create method
✓ correctly validates using create method
explicitly validating primary/auto incremented columns
✓ should emit an error when we try to enter in a string for the id key without validation arguments (40ms)
✓ should emit an error when we try to enter in a string for an auto increment key (not named id)
primaryKey with the name as id with arguments for it's validatio
✓ should emit an error when we try to enter in a string for the id key with validation arguments
✓ should emit an error when we try to enter in a string for an auto increment key through .build().validate()
✓ should emit an error when we try to .save()
pass all paths when validating
✓ produce 3 errors
not null schema validation
✓ correctly throws an error using create method
✓ correctly throws an error using create method with default generated messages
[MYSQL] Instance
decrement
✓ supports transactions (111ms)
✓ with array
✓ with single field
✓ with single field and no value
✓ should still work right with other concurrent updates
✓ should still work right with other concurrent increments
✓ with key value pair
✓ with negative value
✓ with timestamps set to true (38ms)
✓ with timestamps set to true and options.silent set to true (41ms)
[MYSQL] Instance
destroy
✓ supports transactions (40ms)
✓ does not set the deletedAt date in subsequent destroys if dao is paranoid (40ms)
✓ does not update deletedAt with custom default in subsequent destroys (43ms)
✓ deletes a record from the database if dao is not paranoid (45ms)
✓ allows updating soft deleted instance (42ms)
✓ supports custom deletedAt field (44ms)
✓ supports custom deletedAt database column (39ms)
✓ supports custom deletedAt field and database column (44ms)
✓ persists other model changes when soft deleting (46ms)
✓ allows sql logging of delete statements (53ms)
✓ allows sql logging of update statements (43ms)
✓ should not call save hooks when soft deleting
✓ delete a record of multiple primary keys table (39ms)
[MYSQL] Instance
increment
✓ supports transactions (96ms)
✓ supports where conditions
✓ with array
✓ with single field
✓ with single field and no value
✓ should still work right with other concurrent updates
✓ should still work right with other concurrent increments
✓ with key value pair
✓ single value should work when field name is different from database column name
✓ array should work when field name is different from database column name
✓ key value should work when field name is different from database column name
✓ with timestamps set to true
✓ with timestamps set to true and options.silent set to true
[MYSQL] Instance
reload
✓ supports transactions (72ms)
✓ should return a reference to the same DAO instead of creating a new one
✓ should use default internal where
✓ should update the values on all references to the DAO
✓ should support updating a subset of attributes
✓ should update read only attributes as well (updatedAt)
✓ should update the associations as well (93ms)
✓ should update internal options of the instance (85ms)
✓ should return an error when reload fails
✓ should set an association to null after deletion, 1-1 (157ms)
✓ should set an association to empty after all deletion, 1-N (155ms)
✓ should update the associations after one element deleted (203ms)
✓ should inject default scope when reloading (97ms)
[MYSQL] Instance
save
✓ supports transactions (84ms)
✓ only updates fields in passed array
✓ should work on a model with an attribute named length (40ms)
✓ only validates fields in passed array
✓ stores an entry in the database
✓ handles an entry with primaryKey of zero (39ms)
✓ updates the timestamps
✓ does not update timestamps when passing silent=true
✓ does not update timestamps when passing silent=true in a bulk update
✓ updates with function and column value
✓ updates with function that contains escaped dollar symbol
✓ updates with function that contains multiple escaped dollar symbols
✓ should fail a validation upon creating
✓ should fail a validation upon creating with hooks false
✓ should fail a validation upon building
✓ should fail a validation when updating
✓ takes zero into account
✓ saves a record with no primary key
hooks
✓ should update attributes added in hooks when default fields are used
✓ should update attributes changed in hooks when default fields are used
✓ should validate attributes added in hooks when default fields are used
✓ should validate attributes changed in hooks when default fields are used (75ms)
when nothing changed
✓ does not update timestamps
✓ should not throw ER_EMPTY_QUERY if changed only virtual fields
without timestamps option
✓ doesn't update the updatedAt column
with custom timestamp options
✓ updates the createdAt column if updatedAt is disabled
✓ updates the updatedAt column if createdAt is disabled
✓ works with `allowNull: false` on createdAt and updatedAt columns
eagerly loaded objects
✓ saves one object that has a collection of eagerly loaded objects
✓ saves many objects that each a have collection of eagerly loaded objects
✓ saves many objects that each has one eagerly loaded object (to which they belong)
[MYSQL] Instance
toJSON
✓ doesn't return instance that isn't defined
✓ doesn't return instances that aren't defined
✓ includes the eagerly loaded associations
build
✓ returns an object containing all values
✓ returns a response that can be stringified
✓ returns a response that can be stringified and then parsed
create
✓ returns an object containing all values
✓ returns a response that can be stringified
✓ returns a response that can be stringified and then parsed
find
✓ returns an object containing all values
✓ returns a response that can be stringified
✓ returns a response that can be stringified and then parsed
[MYSQL] Instance
update
✓ supports transactions (92ms)
✓ should update fields that are not specified on create
✓ should succeed in updating when values are unchanged (without timestamps)
✓ should update timestamps with milliseconds
✓ should only save passed attributes
✓ should save attributes affected by setters
✓ should not set attributes that are not specified by fields
✓ updates attributes in the database
✓ ignores unknown attributes
✓ ignores undefined attributes (142ms)
✓ doesn't update primary keys or timestamps
✓ stores and restores null values
✓ should support logging
hooks
✓ should update attributes added in hooks when default fields are used
✓ should update attributes changed in hooks when default fields are used
✓ should validate attributes added in hooks when default fields are used
✓ should validate attributes changed in hooks when default fields are used
[MYSQL] DAO
Values
set
✓ doesn't overwrite generated primary keys
✓ doesn't overwrite defined primary keys
✓ doesn't set timestamps
✓ doesn't set underscored timestamps
✓ doesn't set value if not a dynamic setter or a model attribute
✓ allows use of sequelize.fn and sequelize.col in date and bool fields
includes
✓ should support basic includes
✓ should support basic includes (with raw: true)
get
✓ should use custom attribute getters in get(key)
✓ should custom virtual getters in get(key)
✓ should use custom getters in toJSON
✓ should work with save
✓ can pass parameters to getters
plain
✓ should return plain values when true
clone
✓ should copy the values
changed
✓ should return false if object was built from database
✓ should return true if previous value is different
✓ should return false immediately after saving
✓ should be available to a afterUpdate hook
previous
✓ should return an object with the previous values
✓ should return the previous value
model
json
✓ should tell me that a column is json
✓ should use a placeholder for json with insert
✓ should insert json using a custom field name
✓ should update json using a custom field name
✓ should be able retrieve json value as object
✓ should be able to retrieve element of array by index
✓ should be able to retrieve root level value of an object by key
✓ should be able to retrieve nested value of an object by path
✓ should be able to retrieve a row based on the values of the json document
✓ should be able to query using the nested query language
✓ should be able to query using dot notation
✓ should be able to query using dot notation with uppercase name
✓ should be able to query array using property accessor
✓ should be able to store strings
✓ should be able to store values that require JSON escaping
✓ should be able to findOrCreate with values that require JSON escaping
✓ should be able retrieve json value with nested include
[MYSQL] Model
✓ supports multiple async transactions (2399ms)
✓ should be possible to use a key named UUID as foreign key (108ms)
constructor
✓ uses the passed dao name as tablename if freezeTableName
✓ uses the pluralized dao name as tablename unless freezeTableName
✓ uses checks to make sure dao factory is not leaking on multiple define
✓ allows us to predefine the ID column with our own specs
✓ throws an error if 2 autoIncrements are passed
✓ throws an error if a custom model-wide validation is not a function
✓ throws an error if a custom model-wide validation has the same name as a field
✓ should allow me to set a default value for createdAt and updatedAt
✓ should allow me to set a function as default value
✓ should throw `TypeError` when value for updatedAt, createdAt, or deletedAt is neither string nor boolean
✓ should allow me to use `true` as a value for updatedAt, createdAt, and deletedAt fields
✓ should allow me to override updatedAt, createdAt, and deletedAt fields (282ms)
✓ should allow me to disable some of the timestamp fields (47ms)
✓ returns proper defaultValues after save when setter is set
✓ should work with both paranoid and underscored being true
✓ allows multiple column unique keys to be defined
✓ allows unique on column with field aliases
✓ allows us to customize the error message for unique constraint
✓ allows us to map the customized error message with unique constraint name (124ms)
- should allow the user to specify indexes in options
descending indices (MySQL 8 specific)
✓ complains about missing support for descending indexes (118ms)
✓ works fine with InnoDB (114ms)
build
✓ doesn't create database entries
✓ fills the objects with default values
✓ fills the objects with default values
✓ attaches getter and setter methods from attribute definition
✓ attaches getter and setter methods from options
✓ attaches getter and setter methods from options only if not defined in attribute
include
✓ should support basic includes
✓ should support includes with aliases
findOne
✓ supports the transaction option in the first parameter (80ms)
✓ should not fail if model is paranoid and where is an empty array (83ms)
✓ should work if model is paranoid and only operator in where clause is a Symbol (#8406) (78ms)
findOrBuild
✓ supports transactions (80ms)
returns an instance if it already exists
✓ with a single find field
✓ with multiple find fields
✓ builds a new instance with default value.
save
✓ should map the correct fields when saving instance (#10589) (79ms)
update
✓ throws an error if no where clause is given (76ms)
✓ should map the correct fields when updating instance (#10589) (83ms)
✓ supports transactions (81ms)
✓ updates the attributes that we select only without updating createdAt
✓ allows sql logging of updated statements (72ms)
✓ updates only values that match filter
✓ throws an error if where has a key with undefined value
✓ updates only values that match the allowed fields
✓ updates with casting
✓ updates with function and column value
✓ does not update virtual attributes
✓ doesn't update attributes that are altered by virtual setters when option is enabled (39ms)
✓ updates attributes that are altered by virtual setters
✓ should properly set data when individualHooks are true
✓ sets updatedAt to the current timestamp
✓ returns the number of affected rows
✓ does not update soft deleted records when model is paranoid (109ms)
✓ updates soft deleted records when paranoid is overridden (116ms)
✓ calls update hook for soft deleted objects (88ms)
✓ supports limit clause
destroy
✓ `truncate` method should clear the table (100ms)
✓ `truncate` option should clear the table (103ms)
✓ `truncate` option returns a number (95ms)
✓ throws an error if no where clause is given (77ms)
✓ deletes all instances when given an empty where object (80ms)
✓ throws an error if where has a key with undefined value (68ms)
✓ supports transactions (72ms)
✓ deletes values that match filter
✓ works without a primary key (40ms)
✓ supports .field
✓ sets deletedAt to the current timestamp if paranoid is true
✓ does not set deletedAt for previously destroyed instances if paranoid is true
✓ should include deleted associated records if include has paranoid marked as false (129ms)
✓ should delete a paranoid record if I set force to true (50ms)
✓ returns the number of affected rows
✓ supports table schema/prefix (82ms)
✓ should work if model is paranoid and only operator in where clause is a Symbol (77ms)
can't find records marked as deleted with paranoid being true
✓ with the DAOFactory
can find paranoid records if paranoid is marked as false in query
✓ with the DAOFactory (46ms)
restore
✓ rejects with an error if the model is not paranoid
✓ restores a previously deleted model
equals
✓ correctly determines equality of objects
✓ correctly determines equality with multiple primary keys
equalsOneOf
✓ determines equality if one is matching
✓ doesn't determine equality if none is matching
count
✓ supports transactions (392ms)
✓ counts all created objects
✓ returns multiple rows when using group
✓ allows sql logging
✓ filters object
✓ supports distinct option (76ms)
aggregate
Executing (default): SELECT `id` AS `id2`, count(`id`) AS `count` FROM `Users` AS `User` GROUP BY `id2`;
(node:752) [SEQUELIZE0002] DeprecationWarning: The logging-option should be either a function or false. Default: console.log
✓ allows grouping by aliased attribute
options sent to aggregate
✓ modifies option "limit" by setting it to null
✓ modifies option "offset" by setting it to null
✓ modifies option "order" by setting it to null
min
✓ supports transactions (77ms)
✓ returns the correct value
✓ allows sql logging
✓ should allow decimals
✓ should allow strings
✓ should allow dates
✓ should work with fields named as an SQL reserved keyword
max
✓ supports transactions (75ms)
✓ returns the correct value
✓ allows sql logging
✓ should allow decimals
✓ should allow strings
✓ should allow dates
✓ should work with fields named as an SQL reserved keyword
sum
✓ should work in the simplest case
✓ should work with fields named as an SQL reserved keyword
✓ should allow decimals in sum
✓ should accept a where clause
✓ should accept a where clause with custom fields
✓ allows sql logging
schematic support
✓ should be able to drop with schemas
✓ should be able to list schemas
✓ should take schemaDelimiter into account if applicable (49ms)
✓ should describeTable using the default schema settings (40ms)
✓ should be able to reference a table with a schema set (55ms)
✓ should be able to create and update records under any valid schematic
references
✓ uses an existing dao factory and references the author table
✓ uses a table name as a string and references the author table (41ms)
- emits an error event as the referenced table name is invalid
✓ works with comments (190ms)
blob
buffers
✓ should be able to take a buffer as parameter to a BLOB field
✓ should return a buffer when fetching a blob
✓ should work when the database returns null
strings
✓ should be able to take a string as parameter to a BLOB field
✓ should return a buffer when fetching a BLOB, even when the BLOB was inserted as a string
paranoid is true and where is an array
✓ should not fail when array contains Sequelize.or / and
✓ should fail when array contains strings
✓ should not fail with an include
✓ should not overwrite a specified deletedAt by setting paranoid: false
✓ should not overwrite a specified deletedAt (complex query) by setting paranoid: false
Unique
✓ should set unique when unique is true
✓ should not set unique when unique is false
✓ should not set unique when unique is unset
bulkCreate
✓ errors - should return array of errors if validate and individualHooks are true (65ms)
✓ should not use setter when renaming fields in dataValues (73ms)
[MYSQL] Model
attributes
set
✓ should only be called once when used on a join model called with an association getter (100ms)
✓ allows for an attribute to be called "toString"
✓ allows for an attribute to be called "toString" with associations (74ms)
quote
✓ allows for an attribute with dots
[MYSQL] Model
attributes
field
✓ increment should work
✓ decrement should work
✓ sum should work
✓ should create, fetch and update with alternative field names from a simple model
✓ should bulk update (318ms)
✓ should not contain the field properties after create
✓ should make the aliased auto incremented primary key available after create
✓ should work with where on includes for find
✓ should work with where on includes for findAll
✓ should work with increment
✓ should work with a simple where
✓ should work with a where or
✓ should work with bulkCreate and findAll
✓ should support renaming of sequelize method fields (511ms)
✓ should sync foreign keys with custom field names (275ms)
✓ should find the value of an attribute with a custom field name
✓ field names that are the same as property names should create, update, and read correctly
✓ should work with a belongsTo association getter
✓ should work with paranoid instance.destroy() (74ms)
✓ should work with paranoid Model.destroy() (62ms)
✓ should work with `belongsToMany` association `count`
✓ should work with `hasMany` association `count`
primaryKey
✓ should support instance.destroy()
✓ should support Model.destroy()
in combination with allowNull
✓ sets the column to not allow null
field and attribute name is the same
✓ bulkCreate should work
✓ find with where should work
✓ reload should work
✓ save should work
[MYSQL] Model
attributes
types
VIRTUAL
✓ should not be ignored in dataValues get
✓ should be ignored in table creation
✓ should be ignored in find, findAll and includes
✓ should allow me to store selected values (525ms)
✓ should be ignored in create and update
✓ should be ignored in bulkCreate and and bulkUpdate
✓ should be able to exclude with attributes
✓ should be able to include model with virtual attributes
[MYSQL] Model
bulkCreate
✓ supports transactions (75ms)
✓ should not alter options (70ms)
✓ should be able to set createdAt and updatedAt if using silent: true (78ms)
✓ should not fail on validate: true and individualHooks: true (72ms)
✓ should not map instance dataValues to fields with individualHooks: true (77ms)
✓ should not insert NULL for unused fields
✓ properly handles disparate field lists
✓ inserts multiple values respecting the white list
✓ should store all values if no whitelist is specified
✓ should set isNewRecord = false
✓ saves data with single quote
✓ saves data with double quote
✓ saves stringified JSON data
✓ properly handles a model with a length column
✓ stores the current date in createdAt
✓ emits an error when validate is set to true
✓ doesn't emit an error when validate is set to true but our selectedValues are fine
✓ should allow blank arrays (return immediately)
✓ should allow blank creates (with timestamps: false)
✓ should allow autoincremented attributes to be set
✓ should support schemas (229ms)
✓ should support the ignoreDuplicates option
✓ should properly map field names to attribute names
updateOnDuplicate
✓ should support the updateOnDuplicate option
✓ should reject for non array updateOnDuplicate option
✓ should reject for empty array updateOnDuplicate option
should support the updateOnDuplicate option with primary keys
✓ when the primary key column names and model field names are the same
✓ when the primary key column names and model field names are different
✓ when the primary key column names and model field names are different and have unique constraints
✓ when the composite primary key column names and model field names are different
✓ when the primary key column names and model field names are different and have composite unique constraints
✓ [#12516] when the primary key column names and model field names are different and have composite unique index constraints (117ms)
enums
✓ correctly restores enum values
handles auto increment values
✓ should return auto increment primary key values
✓ should return supplied values on primary keys (60ms)
✓ should return supplied values on primary keys when some instances already exists (62ms)
virtual attribute
✓ should validate (59ms)
✓ should not validate (60ms)
[MYSQL] Model
bulkCreate
include
✓ should bulkCreate data for BelongsTo relations (193ms)
✓ should bulkCreate data for BelongsTo relations with no nullable FK (64ms)
✓ should bulkCreate data for BelongsTo relations with alias (65ms)
✓ should bulkCreate data for HasMany relations (67ms)
✓ should bulkCreate data for HasMany relations with alias (71ms)
✓ should bulkCreate data for HasOne relations (71ms)
✓ should bulkCreate data for HasOne relations with alias (73ms)
✓ should bulkCreate data for BelongsToMany relations (101ms)
✓ should bulkCreate data for polymorphic BelongsToMany relations (103ms)
✓ should bulkCreate data for BelongsToMany relations with alias (101ms)
[MYSQL] Model
count
✓ should count rows
✓ should support include
✓ should count groups correctly and return attributes
✓ should not return NaN
✓ should be able to specify column for COUNT()
✓ should be able to specify NO column for COUNT() with DISTINCT
✓ should be able to use where clause on included models
✓ should be able to specify column for COUNT() with includes
✓ should work correctly with include and whichever raw option (42ms)
[MYSQL] Model
✓ should return autoIncrement primary key (create)
✓ should support logging
findOrCreate
✓ supports transactions
✓ supports more than one models per transaction
✓ should error correctly when defaults contain a unique key (75ms)
(sequelize) Warning: Unknown attributes (foo,bar) passed to defaults option of findOrCreate
✓ should error correctly when defaults contain a unique key and a non-existent field (68ms)
✓ should error correctly when defaults contain a unique key and the where clause is complex (72ms)
✓ should work with empty uuid primary key in where (74ms)
✓ should not deadlock with no existing entries and no outer transaction (161ms)
✓ should not deadlock with existing entries and no outer transaction (179ms)
✓ should not deadlock with concurrency duplicate entries and no outer transaction (158ms)
✓ should support special characters in defaults (65ms)
✓ should support bools in defaults (63ms)
✓ returns instance if already existent. Single find field.
✓ Returns instance if already existent. Multiple find fields.
✓ does not include exception catcher in response
✓ creates new instance with default value.
✓ supports .or() (only using default values)
✓ should ignore option returning
✓ should release transaction when meeting errors
several concurrent calls
✓ works with a transaction
✓ should not fail silently with concurrency higher than pool, a unique constraint and a create hook resulting in mismatched values (87ms)
✓ should error correctly when defaults contain a unique key without a transaction (62ms)
✓ works without a transaction
findCreateFind
✓ [Flaky] should work with multiple concurrent calls
✓ should work with multiple concurrent calls within a transaction
create
✓ works with multiple non-integer primary keys with a default value (183ms)
✓ should return an error for a unique constraint error (178ms)
✓ works without any primary key (208ms)
✓ should be able to set createdAt and updatedAt if using silent: true (61ms)
✓ works with custom timestamps with a default value (197ms)
✓ works with custom timestamps and underscored (180ms)
✓ supports transactions
✓ is possible to use casting when creating an instance
✓ is possible to use casting multiple times mixed in with other utilities
✓ is possible to just use .literal() to bypass escaping
✓ is possible to use funtions when creating an instance
✓ should escape $ in sequelize functions arguments
✓ should escape multiple instances of $ in sequelize functions arguments
✓ should work with a non-id named uuid primary key columns (237ms)
✓ is possible to use functions as default values
✓ doesn't allow duplicated records with unique:true
✓ raises an error if created object breaks definition constraints (172ms)
✓ raises an error if created object breaks definition constraints
✓ raises an error if saving an empty string into a column allowing null or URL
✓ raises an error if you mess up the datatype
✓ sets a 64 bit int in bigint
✓ sets auto increment fields
✓ allows the usage of options as attribute
✓ allows sql logging
✓ should only store the values passed in the whitelist
✓ should store all values if no whitelist is specified
✓ can omit autoincremental columns
✓ saves data with single quote
✓ saves data with double quote
✓ saves stringified JSON data
✓ stores the current date in createdAt
✓ allows setting custom IDs
✓ should allow blank creates (with timestamps: false)
✓ should allow truly blank creates
✓ should only set passed fields (182ms)
✓ Works even when SQL query has a values of transaction keywords such as BEGIN TRANSACTION
enums
✓ correctly restores enum values
✓ allows null values
when defined via { field: Sequelize.ENUM }
✓ allows values passed as parameters
✓ allows values passed as an array
when defined via { field: { type: Sequelize.ENUM } }
✓ allows values passed as parameters
✓ allows values passed as an array
can safely sync multiple times
✓ through the factory (82ms)
✓ through sequelize (474ms)
[MYSQL] Model
create
include
✓ should create data for BelongsTo relations (67ms)
✓ should create data for BelongsTo relations with no nullable FK (68ms)
✓ should create data for BelongsTo relations with alias (68ms)
✓ should create data for HasMany relations (95ms)
✓ should create data for HasMany relations with alias (67ms)
✓ should create data for HasOne relations (71ms)
✓ should create data for HasOne relations with alias (70ms)
✓ should create data for BelongsToMany relations (99ms)
✓ should create data for polymorphic BelongsToMany relations (107ms)
✓ should create data for BelongsToMany relations with alias (99ms)
[MYSQL] Model
✓ should support logging
findAll
✓ supports transactions (63ms)
✓ should not crash on an empty where array
✓ should throw on an attempt to fetch no attributes
✓ should not throw if overall attributes are nonempty (56ms)
special where conditions/smartWhere object
✓ should be able to find rows where attribute is in a list of values
✓ should not break when trying to find rows using an array of primary keys
✓ should not break when using smart syntax on binary fields
✓ should be able to find a row using like
✓ should be able to find a row using not like
✓ should be able to find a row between a certain date using the between shortcut
✓ should be able to find a row not between a certain integer using the not between shortcut
✓ should be able to handle false/true values just fine...
✓ should be able to handle false/true values through associations as well... (125ms)
✓ should be able to handle binary values through associations as well... (105ms)
✓ should be able to find a row between a certain date
✓ should be able to find a row between a certain date and an additional where clause
✓ should be able to find a row not between a certain integer
✓ should be able to find a row using not between and between logic
✓ should be able to find a row using not between and between logic with dates
✓ should be able to find a row using greater than or equal to logic with dates
✓ should be able to find a row using greater than or equal to logic with moment dates
✓ should be able to find a row using greater than or equal to
✓ should be able to find a row using greater than
✓ should be able to find a row using lesser than or equal to
✓ should be able to find a row using lesser than
✓ should have no problem finding a row using lesser and greater than
✓ should be able to find a row using not equal to logic
✓ should be able to find multiple users with any of the special where logic properties
eager loading
✓ should not ignore where condition with empty includes, #8771
belongsTo
✓ throws an error about unexpected input if include contains a non-object
✓ throws an error if included DaoFactory is not associated
✓ returns the associated worker via task.worker
✓ returns the associated worker via task.worker, using limit and sort
hasOne
✓ throws an error if included DaoFactory is not associated
✓ returns the associated task via worker.task
hasOne with alias
✓ throws an error if included DaoFactory is not referenced by alias
✓ throws an error if alias is not associated
✓ returns the associated task via worker.task
✓ returns the associated task via worker.task when daoFactory is aliased with model
hasMany
✓ throws an error if included DaoFactory is not associated
✓ returns the associated tasks via worker.tasks
✓ supports sorting on renamed sub-query attribute (101ms)
✓ supports sorting DESC on renamed sub-query attribute (115ms)
✓ supports sorting on multiple renamed sub-query attributes (104ms)
hasMany with alias
✓ throws an error if included DaoFactory is not referenced by alias
✓ throws an error if alias is not associated
✓ returns the associated task via worker.task
✓ returns the associated task via worker.task when daoFactory is aliased with model
queryOptions
✓ should return a DAO when queryOptions are not set
✓ should return a DAO when raw is false
✓ should return raw data when raw is true
include all
✓ includes all associations
✓ includes specific type of association
✓ utilises specified attributes
✓ is over-ruled by specified include
✓ includes all nested associations
properly handles attributes:[] cases
✓ N:M with ignoring include.attributes only
✓ N:M with ignoring through.attributes only
✓ N:M with ignoring include.attributes but having through.attributes
order by eager loaded tables
HasMany
✓ sorts simply
✓ sorts by 1st degree association
✓ sorts simply and by 1st degree association with limit where 1st degree associated instances returned for second one and not the first
✓ sorts by 2nd degree association
✓ sorts by 2nd degree association with alias
✓ sorts by 2nd degree association with alias while using limit
ManyToMany
✓ sorts by 1st degree association
✓ sorts by 1st degree association while using limit
✓ sorts by through table attribute
normal findAll
✓ finds all entries
✓ can also handle object notation
✓ sorts the results via id in ascending order
✓ sorts the results via id in descending order
✓ sorts the results via a date column
✓ handles offset and limit
✓ should allow us to find IDs using capital letters
✓ should be possible to order by sequelize.col()
✓ should pull in dependent fields for a VIRTUAL
✓ should pull in dependent fields for a VIRTUAL in include (107ms)
✓ should throw for undefined where parameters
findAndCountAll
✓ supports transactions (65ms)
✓ handles where clause {only}
✓ handles where clause with ordering {only}
✓ handles offset
✓ handles limit
✓ handles offset and limit
✓ handles offset with includes (119ms)
✓ handles attributes
all
✓ supports transactions (66ms)
✓ should return all users
rejectOnEmpty mode
✓ works from model options
✓ throws custom error with initialized
✓ throws custom error with instance
[MYSQL] Model
findAll
group
✓ should correctly group with attributes, #3009 (70ms)
✓ should not add primary key when grouping using a belongsTo association (76ms)
[MYSQL] Model
findAll
groupedLimit
on: belongsToMany
✓ maps attributes from a grouped limit to models
✓ maps attributes from a grouped limit to models with include
✓ [Flaky] works with computed order
✓ works with multiple orders
✓ works with paranoid junction models
on: hasMany
✓ Applies limit and order correctly
[MYSQL] Model
findAll
order
Sequelize.literal()
✓ should work with order: literal()
✓ should work with order: [literal()]
✓ should work with order: [[literal()]]
injections
✓ should not throw on a literal
✓ should not throw with include when last order argument is a field
[MYSQL] Model
findAll
separate with limit
✓ should not throw syntax error (union) (118ms)
[MYSQL] Model
findOne
✓ supports transactions (62ms)
✓ should support logging
general / basic function
✓ allows bit fields as booleans
✓ treats questionmarks in an array
✓ doesn't throw an error when entering in a non integer value for a specified primary field
✓ returns a single dao
✓ returns a single dao given a string id
✓ should make aliased attributes available
✓ should fail with meaningful error message on invalid attributes definition
✓ should not try to convert boolean values if they are not selected
✓ finds a specific user via where option
✓ doesn't find a user if conditions are not matching
✓ allows sql logging
✓ ignores passed limit option
✓ finds entries via primary keys
✓ finds entries via a string primary key called id
✓ finds entries via a bigint primary key called id
✓ always honors ZERO as primary key
✓ should allow us to find IDs using capital letters (43ms)
eager loading
belongsTo
✓ returns the private and public ip (69ms)
✓ eager loads with non-id primary keys (190ms)
✓ getting parent data in many to one relationship (156ms)
✓ allows mulitple assocations of the same model with different alias (138ms)
generic
✓ throws an error about unexpected input if include contains a non-object
✓ throws an error if included DaoFactory is not associated
✓ returns the associated worker via task.worker (143ms)
hasOne
✓ throws an error if included DaoFactory is not associated
✓ returns the associated task via worker.task
✓ eager loads with non-id primary keys (270ms)
hasOne with alias
✓ throws an error if included DaoFactory is not referenced by alias
alias
✓ throws an error indicating an incorrect alias was entered if an association and alias exist but the alias doesn't match
✓ returns the associated task via worker.task
✓ returns the associated task via worker.task when daoFactory is aliased with model
✓ allows mulitple assocations of the same model with different alias (192ms)
hasMany
✓ throws an error if included DaoFactory is not associated
✓ returns the associated tasks via worker.tasks
✓ including two has many relations should not result in duplicate values (291ms)
✓ eager loads with non-id primary keys (288ms)
hasMany with alias
✓ throws an error if included DaoFactory is not referenced by alias
alias
✓ throws an error indicating an incorrect alias was entered if an association and alias exist but the alias doesn't match
✓ returns the associated task via worker.task
✓ returns the associated task via worker.task when daoFactory is aliased with model
✓ allows mulitple assocations of the same model with different alias (205ms)
hasMany (N:M) with alias
✓ returns the associated models when using through as string and alias (144ms)
✓ returns the associated models when using through as model and alias (134ms)
queryOptions
✓ should return a DAO when queryOptions are not set
✓ should return a DAO when raw is false
✓ should return raw data when raw is true
rejectOnEmpty mode
✓ throws error when record not found by findOne
✓ throws error when record not found by findByPk
✓ throws error when record not found by find
✓ works from model options
✓ override model options
✓ resolve null when disabled
[MYSQL] Model
findOrBuild
✓ initialize with includes
[MYSQL] Model
GEOMETRY
- works with aliases fields
- should create a geometry object
- should update a geometry object
- works with crs field
GEOMETRY(POINT)
- should create a geometry object
- should update a geometry object
- works with crs field
GEOMETRY(LINESTRING)
- should create a geometry object
- should update a geometry object
- works with crs field
GEOMETRY(POLYGON)
- should create a geometry object
- works with crs field
- should update a geometry object
sql injection attacks
- should properly escape the single quotes
- should properly escape the single quotes in coordinates
[MYSQL] Model
increment
✓ supports where conditions
✓ uses correct column names for where conditions
✓ should still work right with other concurrent increments
✓ with array
✓ with single field
✓ with single field and no value
✓ with key value pair
✓ should still work right with other concurrent updates
✓ with timestamps set to true
✓ with timestamps set to true and options.silent set to true
✓ should work with scopes (71ms)
✓ should not care for attributes in the instance scope
✓ should not care for exclude-attributes in the instance scope
✓ should not care for include-attributes in the instance scope
decrement
✓ supports where conditions
✓ uses correct column names for where conditions
✓ should still work right with other concurrent increments
✓ with array
✓ with single field
✓ with single field and no value
✓ with key value pair
✓ should still work right with other concurrent updates
✓ with timestamps set to true
✓ with timestamps set to true and options.silent set to true
✓ should work with scopes (67ms)
✓ should not care for attributes in the instance scope
✓ should not care for exclude-attributes in the instance scope
✓ should not care for include-attributes in the instance scope
[MYSQL] Model
JSON
✓ findOrCreate supports transactions, json and locks
create
✓ should create an instance with JSON data
update
✓ should update with JSON column (dot notation)
✓ should update with JSON column (JSON notation)
✓ should update an instance with JSON data
find
✓ should be possible to query a nested value
✓ should be possible to query dates with array operators
✓ should be possible to query a boolean with array operators
✓ should be possible to query a nested integer value
✓ should be possible to query a nested null value
✓ should be possible to query for nested fields with hyphens/dashes, #8718
✓ should be possible to query multiple nested values
✓ should be possible to query a nested value and order results
destroy
✓ should be possible to destroy with where
sql injection attacks
✓ should properly escape the single quotes
✓ should properly escape path keys
✓ should properly escape path keys with sequelize.json
✓ should properly escape the single quotes in array
✓ should be possible to find with properly escaped select query
✓ should query an instance with JSONB data and order while trying to inject
[MYSQL] Model
max
✓ type A to C should exist
✓ type D should not exist
[MYSQL] Model
optimistic locking
✓ should increment the version on save
✓ should increment the version on update
✓ prevents stale instances from being saved
✓ increment() also increments the version
✓ decrement() also increments the version
[MYSQL] Model
paranoid
✓ should be able to soft delete with timestamps
✓ should be able to soft delete without timestamps
JSON
✓ should soft delete with JSON condition
[MYSQL] Model
scope
✓ should be able to merge attributes as array
✓ should work with Symbol operators
✓ should keep symbols after default assignment
✓ should not throw error with sequelize.where
[MYSQL] Model
scope
aggregate
✓ should apply defaultScope
✓ should be able to override default scope
✓ should be able to unscope
✓ should be able to apply other scopes
✓ should be able to merge scopes with where
✓ should be able to use where on include
[MYSQL] Model
scope
associations
include
✓ should scope columns properly
✓ should apply default scope when including an associations
✓ should apply default scope when including a model
✓ should be able to include a scoped model
get
it should be able to unscope
✓ hasMany
✓ hasOne
✓ belongsTo
✓ belongsToMany
it should apply default scope
✓ hasMany
✓ hasOne
✓ belongsTo
✓ belongsToMany
it should be able to apply another scope
✓ hasMany
✓ hasOne
✓ belongsTo
✓ belongsToMany
scope with includes
✓ should scope columns properly
✓ should apply scope conditions
with different format
✓ should not throw error (460ms)
with find options
✓ should merge includes correctly (471ms)
scope with options
✓ should return correct object included foreign_key (461ms)
✓ should return correct object included foreign_key with defaultScope (436ms)
✓ should not throw error (428ms)
[MYSQL] Model
scope
count
✓ should apply defaultScope
✓ should be able to override default scope
✓ should be able to unscope
✓ should be able to apply other scopes
✓ should be able to merge scopes with where
✓ should be able to merge scopes with where on aliased fields
✓ should ignore the order option if it is found within the scope
✓ should be able to use where on include
✓ should be able to use include with function scope
✓ should be able to use include with function scope and string association
[MYSQL] Model
scope
destroy
✓ should apply defaultScope
✓ should be able to override default scope
✓ should be able to unscope destroy
✓ should be able to apply other scopes
✓ should be able to merge scopes with where
✓ should work with empty where
[MYSQL] Model
scopes
✓ should be able use where in scope
✓ should be able to combine scope and findAll where clauses
✓ should be able to use a defaultScope if declared
✓ should be able to handle $and in scopes
✓ should have no problem performing findOrCreate
✓ should work when included with default scope
should not overwrite
✓ default scope with values from previous finds
✓ other scopes with values from previous finds
scope in associations
✓ should work when association with a virtual column queried with default scope (65ms)
[MYSQL] Model
scope
findAndCountAll
✓ should apply defaultScope
✓ should be able to override default scope
✓ should be able to unscope
✓ should be able to apply other scopes
✓ should be able to merge scopes with where
✓ should ignore the order option if it is found within the scope
[MYSQL] Model
scope
simple merge
✓ should merge simple scopes correctly
complex merge
✓ should merge complex scopes correctly regardless of their order (81ms)
✓ should merge complex scopes with findAll options correctly regardless of their order (77ms)
✓ should merge complex scopes with findOne options correctly regardless of their order (73ms)
[MYSQL] Model
scope
update
✓ should apply defaultScope
✓ should be able to override default scope
✓ should be able to unscope destroy
✓ should be able to apply other scopes
✓ should be able to merge scopes with where
✓ should work with empty where
[MYSQL] Model
sum
✓ should sum without rows
✓ should sum when is 0
✓ should sum
[MYSQL] Model
sync
✓ should remove a column if it exists in the databases schema but not the model (211ms)
✓ should add a column if it exists in the model but not the database (183ms)
✓ should not remove columns if drop is set to false in alter configuration
✓ should remove columns if drop is set to true in alter configuration (155ms)
✓ should alter a column using the correct column name (#9515) (132ms)
✓ should change a column if it exists in the model but is different in the database (167ms)
✓ should not alter table if data type does not change (119ms)
✓ should properly create composite index without affecting individual fields (126ms)
✓ should properly create composite index that fails on constraint violation (104ms)
✓ supports creating tables with cyclic associations (364ms)
✓ supports creating two identically named tables in different schemas (56ms)
with { alter: true }
✓ should properly alter tables when there are foreign keys (340ms)
✓ does not recreate existing enums (#7649) (231ms)
indexes
✓ should create only one unique index for unique:true column
✓ should create only one unique index for unique:true columns
✓ should create only one unique index for unique:true columns taking care of options.indexes (102ms)
✓ should create only one unique index for unique:name column
✓ should create only one unique index for unique:name columns
with alter:true
✓ should not duplicate named indexes after multiple sync calls (638ms)
✓ should not duplicate unnamed indexes after multiple sync calls (631ms)
[MYSQL] Model
update
✓ should only update the passed fields
✓ changed should be false after reload
✓ should ignore undefined values without throwing not null validation
✓ should only update one row
skips update query
✓ if no data to update
✓ skips when timestamps disabled
[MYSQL] Model
upsert
✓ works with upsert on id
✓ works with upsert on a composite key
✓ should work with UUIDs wth default values (55ms)
✓ works with upsert on a composite primary key (67ms)
✓ supports validations
✓ supports skipping validations (57ms)
✓ works with BLOBs
✓ works with .field
✓ works with primary key using .field
✓ works with database functions
✓ does not overwrite createdAt time on update
✓ does not overwrite createdAt when supplied as an explicit insert value when using fields
✓ falls back to a noop if no update values are found in the upsert data (60ms)
✓ does not update using default values
✓ does not update when setting current values
✓ works when two separate uniqueKeys are passed (61ms)
✓ works when indexes are created via indexes array (220ms)
✓ works when composite indexes are created via indexes array (148ms)
[MYSQL] Operators
REGEXP
case sensitive
✓ should work with a regexp where
✓ should work with a not regexp where
✓ should properly escape regular expressions
[MYSQL] Pooling
network / connection errors
✓ should obtain new connection when old connection is abruptly closed
✓ should obtain new connection when released connection dies inside pool
idle
✓ should maintain connection within idle range (96ms)
✓ [MSSQL Flaky] should get new connection beyond idle range (117ms)
acquire
✓ should reject with ConnectionAcquireTimeoutError when unable to acquire connection
✓ should reject with ConnectionAcquireTimeoutError when unable to acquire connection for transaction
[MYSQL] QueryInterface
dropAllSchema
✓ should drop all schema
showAllTables
✓ should not contain views (102ms)
✓ should not show tables in other databases (103ms)
✓ should show all tables in all databases (111ms)
renameTable
✓ should rename table (56ms)
dropAllTables
✓ should drop all tables (112ms)
✓ should be able to skip given tables (74ms)
indexes
✓ adds, reads and removes an index to the table (127ms)
✓ works with schemas (102ms)
✓ does not fail on reserved keywords (72ms)
renameColumn
✓ rename a simple column (45ms)
✓ works with schemas (52ms)
✓ rename a column non-null without default value (53ms)
✓ rename a boolean column non-null without default value (54ms)
- renames a column primary key autoIncrement column
✓ shows a reasonable error message when column is missing
addColumn
- should be able to add a foreign key reference
✓ addColumn expected error
✓ should work with schemas (79ms)
✓ should work with enums (1) (49ms)
✓ should work with enums (2) (47ms)
describeForeignKeys
✓ should get a list of foreign keys for the table
✓ should get a list of foreign key references details for the table
constraints
unique
✓ should add, read & remove unique constraint (145ms)
✓ should add a constraint after another (313ms)
primary key
- should add, read & remove primary key constraint
foreign key
- should add, read & remove foreign key constraint
unknown constraint
✓ should throw non existent constraints as UnknownConstraintError
[MYSQL] QueryInterface
changeColumn
✓ should support schemas (114ms)
✓ should change columns (103ms)
✓ should work with enums (case 1) (102ms)
✓ should work with enums (case 2) (107ms)
✓ should work with enums with schemas (117ms)
should support foreign keys
✓ able to change column to foreign key (152ms)
✓ able to change column property without affecting other properties (142ms)
✓ should change the comment of column
[MYSQL] QueryInterface
createTable
✓ should create a auto increment primary key
✓ should create unique constraint with uniqueKeys
✓ should work with schemas
enums
✓ should work with enums (1)
✓ should work with enums (2)
✓ should work with enums (3)
✓ should work with enums (4)
✓ should work with enums (5)
[MYSQL] QueryInterface
describeTable
✓ rejects when no data is available
✓ reads the metadata of the table
✓ should correctly determine the primary key columns (61ms)
[MYSQL] QueryInterface
getForeignKeyReferencesForTable
✓ should be able to provide existing foreign keys (66ms)
[MYSQL] QueryInterface
removeColumn
(without a schema)
✓ should be able to remove a column with a default value (80ms)
✓ should be able to remove a column without default value (87ms)
✓ should be able to remove a column with a foreign key constraint (100ms)
- should be able to remove a column with primaryKey
✓ should be able to remove a column with unique contraint (89ms)
(with a schema)
✓ [Flaky] should be able to remove a column with a default value (93ms)
✓ should be able to remove a column without default value (86ms)
- should be able to remove a column with primaryKey
✓ should be able to remove a column with unique contraint (83ms)
[MYSQL] Replication
Executing (default): DROP TABLE IF EXISTS `Users`;
Executing (default): CREATE TABLE IF NOT EXISTS `Users` (`id` INTEGER NOT NULL auto_increment , `first_name` VARCHAR(255), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `Users`
Executing (default): INSERT INTO `Users` (`id`,`first_name`,`createdAt`,`updatedAt`) VALUES (DEFAULT,?,?,?);
✓ should be able to make a write
Executing (default): DROP TABLE IF EXISTS `Users`;
Executing (default): CREATE TABLE IF NOT EXISTS `Users` (`id` INTEGER NOT NULL auto_increment , `first_name` VARCHAR(255), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `Users`
Executing (default): SELECT `id`, `first_name` AS `firstName`, `createdAt`, `updatedAt` FROM `Users` AS `User`;
✓ should be able to make a read
Executing (default): DROP TABLE IF EXISTS `Users`;
Executing (default): CREATE TABLE IF NOT EXISTS `Users` (`id` INTEGER NOT NULL auto_increment , `first_name` VARCHAR(255), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `Users`
Executing (445ab5c9-72f9-4f2b-ad96-b10402352fa5): START TRANSACTION;
Executing (445ab5c9-72f9-4f2b-ad96-b10402352fa5): SELECT `id`, `first_name` AS `firstName`, `createdAt`, `updatedAt` FROM `Users` AS `User`;
Executing (445ab5c9-72f9-4f2b-ad96-b10402352fa5): COMMIT;
✓ should run read-only transactions on the replica
Executing (default): DROP TABLE IF EXISTS `Users`;
Executing (default): CREATE TABLE IF NOT EXISTS `Users` (`id` INTEGER NOT NULL auto_increment , `first_name` VARCHAR(255), `createdAt` DATETIME NOT NULL, `updatedAt` DATETIME NOT NULL, PRIMARY KEY (`id`)) ENGINE=InnoDB;
Executing (default): SHOW INDEX FROM `Users`
Executing (3eef9571-bb50-4845-8d19-3562a91781b3): START TRANSACTION;
Executing (3eef9571-bb50-4845-8d19-3562a91781b3): SELECT `id`, `first_name` AS `firstName`, `createdAt`, `updatedAt` FROM `Users` AS `User`;
Executing (3eef9571-bb50-4845-8d19-3562a91781b3): COMMIT;
✓ should run non-read-only transactions on the primary
[MYSQL] Schema
✓ supports increment
✓ supports decrement
[MYSQL] Sequelize
constructor
✓ should pass the global options correctly
✓ should correctly set the host and the port
✓ should set operators aliases on dialect queryGenerator
(node:752) [SEQUELIZE0003] DeprecationWarning: String based operators are deprecated. Please use Symbol based operators for better security, read more at https://sequelize.org/master/manual/querying.html#operators
authenticate
with valid credentials
✓ triggers the success event
with an invalid connection
✓ triggers the error event
✓ triggers an actual RangeError or ConnectionError
✓ triggers the actual adapter error
with invalid credentials
✓ triggers the error event
✓ triggers an actual sequlize error
✓ triggers the error event when using replication
validate
✓ is an alias for .authenticate()
getDialect
✓ returns the defined dialect
getDatabaseName
✓ returns the database name
isDefined
✓ returns false if the dao wasn't defined before
✓ returns true if the dao was defined before
model
✓ throws an error if the dao being accessed is undefined
✓ returns the dao factory defined by daoName
set
✓ should be configurable with global functions
set
✓ should return an promised error if transaction isn't defined
✓ one value
✓ multiple values
define
✓ adds a new dao to the dao manager
✓ adds a new dao to sequelize.models
✓ overwrites global options
✓ overwrites global rowFormat options
✓ inherits global collate option
✓ inherits global rowFormat option
✓ uses the passed tableName (45ms)
truncate
✓ truncates all models (85ms)
sync
✓ synchronizes all models (63ms)
✓ works with correct database credentials
✓ fails with incorrect match condition
✓ fails for incorrect connection even when no models are defined
✓ fails with incorrect database credentials (1)
✓ fails with incorrect database credentials (2)
✓ fails with incorrect database credentials (3)
✓ fails with incorrect database credentials (4)
✓ returns an error correctly if unable to sync a foreign key referenced model
✓ handles this dependant foreign key constraints (41ms)
✓ return the sequelize instance after syncing
✓ return the single dao after syncing
✓ handles alter: true with underscore correctly
doesn't emit logging when explicitly saying not to
✓ through Sequelize.sync()
✓ through DAOFactory.sync()
match
✓ will return an error not matching
drop should work
✓ correctly succeeds (67ms)
define
✓ raises an error if no values are defined
define
enum
✓ raises an error if no values are defined
✓ correctly stores values
✓ correctly loads values
✓ doesn't save an instance if value is not in the range of enums
enum
✓ raises an error if no values are defined
✓ correctly stores values
✓ correctly loads values
✓ doesn't save an instance if value is not in the range of enums
table
✓ should be able to override options on the default attributes
✓ should be able to override options on the default attributes
✓ should be able to override options on the default attributes
transaction
✓ is a transaction method available
✓ passes a transaction object to the callback
✓ allows me to define a callback on the result
✓ correctly handles multiple transactions
✓ supports nested transactions using savepoints
✓ supports rolling back a nested transaction
✓ supports rolling back outermost transaction
supports rolling back to savepoints
✓ rolls back to the first savepoint, undoing everything
✓ rolls back to the most recent savepoint, only undoing recent changes
databaseVersion
✓ should database/dialect version
paranoid deletedAt non-null default value
✓ should use defaultValue of deletedAt in paranoid clause and restore (44ms)
[MYSQL] Sequelize#transaction
✓ works for long running transactions (4254ms)
Transaction#commit
✓ returns a promise that resolves once the transaction has been committed
Committing transaction 62a917e4-7e4e-4639-bca6-de97f8c78ed1 failed with error "Oh no, an error!". We are killing its connection as it is now in an undetermined state.
✓ does not pollute the pool with broken connections if commit fails
Transaction#rollback
✓ returns a promise that resolves once the transaction has been rolled back
Rolling back transaction 5fffb2ec-9e1d-4846-942a-64cb17228212 failed with error "Oh no, an error!". We are killing its connection as it is now in an undetermined state.
✓ does not pollute the pool with broken connections if the rollback fails
complex long running example
✓ works with promise syntax (1044ms)
concurrency: having tables with uniqueness constraints
✓ triggers the error event for the second transactions (108ms)
Sequelize#drop
✓ supports dropping cyclic associations (1280ms)
[MYSQL] Sequelize
log
with disabled logging
✓ does not call the log method of the logger
with default logging options
called with no arguments
✓ calls the log method
✓ logs an empty string as info event
called with one argument
✓ logs the passed string as info event
called with more than two arguments
✓ passes the arguments to the logger
with a custom function for logging
✓ calls the custom logger method
✓ calls the custom logger method with options
[MYSQL] Sequelize
query
✓ executes a query the internal way
✓ executes a query if only the sql is passed
✓ executes a query if a placeholder value is an array
✓ executes select queries correctly
✓ executes select queries correctly when quoteIdentifiers is false
✓ executes select query with dot notation results
✓ executes select query with dot notation results and nest it
- executes stored procedures
✓ uses the passed model
✓ maps the field names to attributes based on the passed model
✓ arbitrarily map the field names
✓ keeps field names that are mapped to the same name
✓ properly adds and escapes replacement value
✓ it allows to pass custom class instances
✓ uses properties `query` and `values` if query is tagged
✓ uses properties `query` and `bind` if query is tagged
✓ dot separated attributes when doing a raw query without nest
✓ destructs dot separated attributes when doing a raw query using nest
✓ replaces token with the passed array
✓ replaces named parameters with the passed object
✓ replaces named parameters with the passed object and ignore those which does not qualify
✓ replaces named parameters with the passed object using the same key twice
✓ replaces named parameters with the passed object having a null property
✓ binds token with the passed array
✓ binds named parameters with the passed object
✓ binds named parameters with the passed object using the same key twice
✓ binds named parameters with the passed object having a null property
✓ binds named parameters array handles escaped $$
✓ binds named parameters object handles escaped $$
✓ escape where has $ on the middle of characters
✓ handles AS in conjunction with functions just fine
QueryTypes
✓ RAW
retry
✓ properly bind parameters on extra retries (221ms)
logging
✓ executes a query with global benchmarking option and custom logger
✓ executes a query with benchmarking option and custom logger
with logQueryParameters
✓ add parameters in log sql
✓ add parameters in log sql when use bind value
stacktraces
✓ emits raw errors if requested
✓ emits full stacktraces for generic database error
✓ emits full stacktraces for unique constraint error
✓ emits full stacktraces for constraint validation error
rejections
✓ reject if `values` and `options.replacements` are both passed
✓ reject if `sql.bind` and `options.bind` are both passed
✓ reject if `options.replacements` and `options.bind` are both passed
✓ reject if `sql.bind` and `sql.values` are both passed
✓ reject if `sql.bind` and `options.replacements`` are both passed
✓ reject if `options.bind` and `sql.replacements` are both passed
✓ reject when key is missing in the passed object
✓ reject with the passed number
✓ reject with the passed empty object
✓ reject with the passed string
(node:752) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
✓ reject with the passed date
✓ reject when binds passed with object and numeric $1 is also present
✓ reject when binds passed as array and $alpha is also present
✓ reject when bind key is $0 with the passed array
✓ reject when bind key is $01 with the passed array
✓ reject when bind key is missing in the passed array
✓ reject when bind key is missing in the passed object
✓ reject with the passed number for bind
✓ reject with the passed empty object for bind
✓ reject with the passed string for bind
✓ reject with the passed date for bind
[MYSQL] Timezone
✓ returns the same value for current timestamp
✓ handles existing timestamps
Ignoring invalid timezone passed to Connection: America/New_York. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
Ignoring invalid timezone passed to Connection: America/New_York. This is currently a warning, but in future versions of MySQL2, an error will be thrown if you pass an invalid configuration option to a Connection
✓ handles named timezones (49ms)
[MYSQL] Transaction
✓ does not allow queries after commit
✓ does not allow queries immediately after commit call
✓ does not allow queries after rollback
✓ should not rollback if connection was not acquired
✓ does not allow queries immediately after rollback call
✓ does not allow commits after commit
✓ should run hooks if a non-auto callback transaction is committed
✓ should not run hooks if a non-auto callback transaction is rolled back
✓ should throw an error if null is passed to afterCommit
✓ should throw an error if undefined is passed to afterCommit
✓ should throw an error if an object is passed to afterCommit
✓ does not allow commits after rollback
✓ does not allow rollbacks after commit
✓ does not allow rollbacks after rollback
✓ works even if a transaction: null option is passed
✓ works even if a transaction: undefined option is passed
constructor
✓ stores options
✓ generates an identifier
✓ should call dialect specific generateTransactionId method
commit
✓ is a commit method available
rollback
✓ is a rollback method available
autoCallback
✓ supports automatically committing
✓ supports automatically rolling back with a thrown error
✓ supports automatically rolling back with a rejection
✓ supports running hooks when a transaction is committed
✓ does not run hooks when a transaction is rolled back
deadlock handling
- should treat deadlocked transaction as rollback
- should release the connection for a deadlocked transaction (1/2)
- should release the connection for a deadlocked transaction (2/2)
isolation levels
✓ should read the most recent committed rows when using the READ COMMITTED isolation level (38ms)
✓ should not read newly committed rows when using the REPEATABLE READ isolation level
- should block updates after reading a row using SERIALIZABLE
row locking
✓ supports for update (2045ms)
✓ fail locking with outer joins (123ms)
- supports for share (i.e. `SELECT ... LOCK IN SHARE MODE`)
[MYSQL] Utils
underscore
underscoredIf
✓ is defined
✓ underscores if second param is true
✓ doesn't underscore if second param is false
camelizeIf
✓ is defined
✓ camelizes if second param is true
✓ doesn't camelize if second param is false
format
✓ should format where clause correctly when the value is truthy
✓ should format where clause correctly when the value is false
cloneDeep
✓ should clone objects
✓ should clone nested objects
✓ should not call clone methods on plain objects
✓ should not call clone methods on arrays
inflection
✓ works better than lingo ;)
Sequelize.fn
✓ accepts condition object (with cast)
✓ accepts condition object (auto casting)
flattenObjectDeep
✓ should return the value if it is not an object
✓ should return correctly if values are null
[MYSQL] Vectors
✓ should not allow insert backslash
1772 passing (7m)
33 pending
Done in 401.22s.
sequelize orm v6 test end
[Pipeline] }
Cache not saved (ws/jenkins-pingcap-tidb-merged_integration_nodejs_test-4664/tidb-test already exists)
[Pipeline] // cache
[Pipeline] }
[Pipeline] // dir
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // parallel
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // timeout
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // podTemplate
[Pipeline] End of Pipeline
ERROR: script returned exit code 2
Finished: FAILURE