@budibase/server 1.3.21 → 1.3.22-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/__mocks__/mongodb.ts +1 -1
- package/builder/assets/index.96c69636.js +1008 -0
- package/builder/assets/index.c167b5c3.css +6 -0
- package/builder/index.html +2 -4
- package/coverage/clover.xml +308 -338
- package/coverage/coverage-final.json +19 -21
- package/coverage/lcov-report/api/controllers/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/controllers/auth.js.html +41 -8
- package/coverage/lcov-report/api/controllers/automation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/backup.js.html +1 -1
- package/coverage/lcov-report/api/controllers/cloud.js.html +1 -1
- package/coverage/lcov-report/api/controllers/datasource.js.html +73 -34
- package/coverage/lcov-report/api/controllers/dev.js.html +1 -1
- package/coverage/lcov-report/api/controllers/index.html +27 -57
- package/coverage/lcov-report/api/controllers/integration.js.html +6 -6
- package/coverage/lcov-report/api/controllers/layout.js.html +1 -1
- package/coverage/lcov-report/api/controllers/metadata.js.html +1 -1
- package/coverage/lcov-report/api/controllers/migrations.js.html +1 -1
- package/coverage/lcov-report/api/controllers/permission.js.html +1 -1
- package/coverage/lcov-report/api/controllers/query/index.html +1 -1
- package/coverage/lcov-report/api/controllers/query/validation.js.html +1 -1
- package/coverage/lcov-report/api/controllers/role.js.html +1 -1
- package/coverage/lcov-report/api/controllers/routing.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/external.js.html +2 -2
- package/coverage/lcov-report/api/controllers/row/index.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internal.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/staticFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/row/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/script.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/bulkFormula.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/external.js.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/templates.js.html +1 -1
- package/coverage/lcov-report/api/controllers/user.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/utils.js.html +1 -1
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +1 -1
- package/coverage/lcov-report/api/controllers/webhook.js.html +1 -1
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +13 -13
- package/coverage/lcov-report/api/routes/analytics.js.html +1 -1
- package/coverage/lcov-report/api/routes/apikeys.js.html +1 -1
- package/coverage/lcov-report/api/routes/auth.js.html +1 -1
- package/coverage/lcov-report/api/routes/automation.js.html +1 -1
- package/coverage/lcov-report/api/routes/backup.js.html +1 -1
- package/coverage/lcov-report/api/routes/cloud.js.html +1 -1
- package/coverage/lcov-report/api/routes/component.js.html +1 -1
- package/coverage/lcov-report/api/routes/datasource.js.html +1 -1
- package/coverage/lcov-report/api/routes/deploy.js.html +1 -1
- package/coverage/lcov-report/api/routes/dev.js.html +1 -1
- package/coverage/lcov-report/api/routes/index.html +1 -1
- package/coverage/lcov-report/api/routes/integration.js.html +1 -1
- package/coverage/lcov-report/api/routes/layout.js.html +1 -1
- package/coverage/lcov-report/api/routes/metadata.js.html +1 -1
- package/coverage/lcov-report/api/routes/migrations.js.html +1 -1
- package/coverage/lcov-report/api/routes/permission.js.html +1 -1
- package/coverage/lcov-report/api/routes/query.js.html +1 -1
- package/coverage/lcov-report/api/routes/role.js.html +1 -1
- package/coverage/lcov-report/api/routes/routing.js.html +1 -1
- package/coverage/lcov-report/api/routes/screen.js.html +1 -1
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/table.js.html +2 -2
- package/coverage/lcov-report/api/routes/templates.js.html +1 -1
- package/coverage/lcov-report/api/routes/user.js.html +1 -1
- package/coverage/lcov-report/api/routes/utils/index.html +9 -9
- package/coverage/lcov-report/api/routes/utils/validators.js.html +75 -12
- package/coverage/lcov-report/api/routes/view.js.html +1 -1
- package/coverage/lcov-report/api/routes/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/actions.js.html +1 -1
- package/coverage/lcov-report/automations/automationUtils.js.html +1 -1
- package/coverage/lcov-report/automations/bullboard.js.html +1 -1
- package/coverage/lcov-report/automations/index.html +1 -1
- package/coverage/lcov-report/automations/index.js.html +1 -1
- package/coverage/lcov-report/automations/steps/bash.js.html +1 -1
- package/coverage/lcov-report/automations/steps/delay.js.html +1 -1
- package/coverage/lcov-report/automations/steps/discord.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +1 -1
- package/coverage/lcov-report/automations/steps/executeScript.js.html +1 -1
- package/coverage/lcov-report/automations/steps/filter.js.html +1 -1
- package/coverage/lcov-report/automations/steps/index.html +1 -1
- package/coverage/lcov-report/automations/steps/integromat.js.html +1 -1
- package/coverage/lcov-report/automations/steps/loop.js.html +1 -1
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +1 -1
- package/coverage/lcov-report/automations/steps/queryRows.js.html +1 -1
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +1 -1
- package/coverage/lcov-report/automations/steps/serverLog.js.html +1 -1
- package/coverage/lcov-report/automations/steps/slack.js.html +1 -1
- package/coverage/lcov-report/automations/steps/updateRow.js.html +1 -1
- package/coverage/lcov-report/automations/steps/utils.js.html +1 -1
- package/coverage/lcov-report/automations/steps/zapier.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +1 -1
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +1 -1
- package/coverage/lcov-report/automations/triggers.js.html +1 -1
- package/coverage/lcov-report/constants/index.html +1 -1
- package/coverage/lcov-report/constants/index.js.html +1 -1
- package/coverage/lcov-report/constants/layouts.js.html +1 -1
- package/coverage/lcov-report/constants/screens.js.html +1 -1
- package/coverage/lcov-report/db/inMemoryView.js.html +1 -1
- package/coverage/lcov-report/db/index.html +14 -14
- package/coverage/lcov-report/db/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.html +1 -1
- package/coverage/lcov-report/db/linkedRows/index.js.html +1 -1
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +1 -1
- package/coverage/lcov-report/db/newid.js.html +2 -2
- package/coverage/lcov-report/db/utils.js.html +30 -18
- package/coverage/lcov-report/events/AutomationEmitter.js.html +3 -3
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +1 -1
- package/coverage/lcov-report/events/utils.js.html +1 -1
- package/coverage/lcov-report/index.html +44 -44
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/middleware/appInfo.js.html +1 -1
- package/coverage/lcov-report/middleware/builder.js.html +12 -12
- package/coverage/lcov-report/middleware/currentapp.js.html +46 -40
- package/coverage/lcov-report/middleware/index.html +15 -15
- package/coverage/lcov-report/middleware/joi-validator.js.html +1 -1
- package/coverage/lcov-report/middleware/publicApi.js.html +1 -1
- package/coverage/lcov-report/middleware/resourceId.js.html +7 -7
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/utils.js.html +2 -2
- package/coverage/lcov-report/utilities/budibaseDir.js.html +3 -3
- package/coverage/lcov-report/utilities/centralPath.js.html +4 -4
- package/coverage/lcov-report/utilities/csvParser.js.html +1 -1
- package/coverage/lcov-report/utilities/global.js.html +16 -16
- package/coverage/lcov-report/utilities/index.html +15 -15
- package/coverage/lcov-report/utilities/index.js.html +24 -24
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +2 -2
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +1 -1
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +1 -1
- package/coverage/lcov-report/utilities/scriptRunner.js.html +1 -1
- package/coverage/lcov-report/utilities/security.js.html +2 -2
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/index.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/rows.js.html +1 -1
- package/coverage/lcov-report/utilities/usageQuota/usageQuoteReset.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +1 -1
- package/coverage/lcov-report/utilities/workerRequests.js.html +32 -8
- package/coverage/lcov.info +521 -558
- package/dist/api/controllers/application.js +5 -5
- package/dist/api/controllers/auth.js +9 -0
- package/dist/api/controllers/component.js +19 -6
- package/dist/api/controllers/datasource.js +21 -8
- package/dist/api/controllers/deploy/index.js +1 -8
- package/dist/api/controllers/integration.js +4 -4
- package/dist/{migrations/functions/usageQuotas/syncDevelopers.js → api/controllers/plugin/file.js} +13 -13
- package/dist/api/controllers/plugin/github.js +69 -0
- package/dist/api/controllers/plugin/index.js +144 -0
- package/dist/api/controllers/plugin/npm.js +58 -0
- package/dist/api/controllers/plugin/uploaders.js +11 -0
- package/dist/{migrations/functions/usageQuotas/syncPublishedApps.js → api/controllers/plugin/url.js} +13 -15
- package/dist/api/controllers/plugin/utils.js +26 -0
- package/dist/api/controllers/row/external.js +1 -1
- package/dist/api/controllers/screen.js +62 -14
- package/dist/api/controllers/static/index.js +1 -0
- package/dist/api/controllers/static/templates/BudibaseApp.svelte +10 -0
- package/dist/api/controllers/static/templates/preview.hbs +5 -1
- package/dist/api/index.js +1 -1
- package/dist/api/routes/application.js +3 -2
- package/dist/api/routes/index.js +2 -0
- package/dist/{migrations/functions/publishedAppsQuota.js → api/routes/plugin.js} +13 -21
- package/dist/api/routes/public/rows.js +1 -82
- package/dist/api/routes/public/tables.js +1 -1
- package/dist/api/routes/table.js +1 -1
- package/dist/api/routes/utils/validators.js +20 -2
- package/dist/app.js +16 -1
- package/dist/db/utils.js +3 -0
- package/dist/environment.js +1 -0
- package/dist/integrations/airtable.js +126 -129
- package/dist/integrations/arangodb.js +86 -89
- package/dist/integrations/base/query.js +2 -2
- package/dist/integrations/base/sqlTable.js +3 -1
- package/dist/integrations/couchdb.js +80 -83
- package/dist/integrations/dynamodb.js +161 -164
- package/dist/integrations/elasticsearch.js +135 -138
- package/dist/integrations/firebase.js +154 -157
- package/dist/integrations/googlesheets.js +323 -327
- package/dist/integrations/index.js +99 -51
- package/dist/integrations/microsoftSqlServer.js +240 -243
- package/dist/integrations/mongodb.js +239 -242
- package/dist/integrations/mysql.js +215 -219
- package/dist/integrations/oracle.js +318 -322
- package/dist/integrations/postgres.js +262 -265
- package/dist/integrations/redis.js +134 -139
- package/dist/integrations/rest.js +289 -292
- package/dist/integrations/s3.js +61 -64
- package/dist/integrations/snowflake.js +83 -86
- package/dist/middleware/currentapp.js +2 -0
- package/dist/migrations/functions/backfill/global.js +0 -3
- package/dist/migrations/index.js +0 -10
- package/dist/package.json +9 -6
- package/dist/tests/utilities/TestConfiguration.js +1 -1
- package/dist/threads/query.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/index.js +105 -1
- package/dist/utilities/workerRequests.js +4 -0
- package/dist/watch.js +77 -0
- package/dist/websocket.js +22 -0
- package/package.json +10 -7
- package/scripts/dev/manage.js +4 -0
- package/scripts/localdomain.js +3 -1
- package/specs/openapi.json +115 -112
- package/specs/openapi.yaml +96 -94
- package/specs/resources/misc.js +116 -0
- package/specs/resources/query.js +1 -1
- package/src/api/controllers/application.ts +1 -2
- package/src/api/controllers/auth.js +11 -0
- package/src/api/controllers/component.ts +57 -0
- package/src/api/controllers/datasource.js +21 -8
- package/src/api/controllers/deploy/index.ts +1 -6
- package/src/api/controllers/integration.js +4 -4
- package/src/api/controllers/plugin/file.ts +15 -0
- package/src/api/controllers/plugin/github.ts +75 -0
- package/src/api/controllers/plugin/index.ts +134 -0
- package/src/api/controllers/plugin/npm.ts +56 -0
- package/src/api/controllers/plugin/uploaders.ts +4 -0
- package/src/api/controllers/plugin/url.ts +12 -0
- package/src/api/controllers/plugin/utils.ts +19 -0
- package/src/api/controllers/public/mapping/types.ts +8 -0
- package/src/api/controllers/row/external.js +1 -1
- package/src/api/controllers/screen.ts +122 -0
- package/src/api/controllers/static/index.ts +1 -1
- package/src/api/controllers/static/templates/BudibaseApp.svelte +10 -0
- package/src/api/controllers/static/templates/preview.hbs +5 -1
- package/src/api/index.js +1 -1
- package/src/api/routes/application.ts +13 -2
- package/src/api/routes/index.ts +2 -0
- package/src/api/routes/plugin.ts +14 -0
- package/src/api/routes/public/rows.ts +1 -82
- package/src/api/routes/public/tables.ts +1 -1
- package/src/api/routes/table.js +1 -1
- package/src/api/routes/tests/query.spec.js +8 -25
- package/src/api/routes/tests/user.spec.js +0 -2
- package/src/api/routes/utils/validators.js +26 -5
- package/src/app.ts +25 -2
- package/src/db/utils.js +4 -0
- package/src/definitions/openapi.ts +56 -55
- package/src/environment.js +1 -0
- package/src/integrations/airtable.ts +116 -118
- package/src/integrations/arangodb.ts +87 -89
- package/src/integrations/base/query.ts +2 -2
- package/src/integrations/base/sqlTable.ts +3 -1
- package/src/integrations/couchdb.ts +83 -89
- package/src/integrations/dynamodb.ts +173 -175
- package/src/integrations/elasticsearch.ts +120 -122
- package/src/integrations/firebase.ts +157 -159
- package/src/integrations/googlesheets.ts +328 -338
- package/src/integrations/index.ts +64 -21
- package/src/integrations/microsoftSqlServer.ts +249 -251
- package/src/integrations/mongodb.ts +261 -258
- package/src/integrations/mysql.ts +229 -234
- package/src/integrations/oracle.ts +373 -380
- package/src/integrations/postgres.ts +264 -268
- package/src/integrations/redis.ts +128 -132
- package/src/integrations/rest.ts +324 -329
- package/src/integrations/s3.ts +68 -71
- package/src/integrations/snowflake.ts +80 -82
- package/src/integrations/tests/{airtable.spec.js → airtable.spec.ts} +21 -18
- package/src/integrations/tests/{arangodb.spec.js → arangodb.spec.ts} +12 -9
- package/src/integrations/tests/{couchdb.spec.js → couchdb.spec.ts} +33 -27
- package/src/integrations/tests/{dynamodb.spec.js → dynamodb.spec.ts} +45 -41
- package/src/integrations/tests/{elasticsearch.spec.js → elasticsearch.spec.ts} +22 -21
- package/src/integrations/tests/{firebase.spec.js → firebase.spec.ts} +33 -28
- package/src/integrations/tests/{microsoftSqlServer.spec.js → microsoftSqlServer.spec.ts} +12 -11
- package/src/integrations/tests/{mongo.spec.js → mongo.spec.ts} +46 -35
- package/src/integrations/tests/{mysql.spec.js → mysql.spec.ts} +17 -15
- package/src/integrations/tests/{oracle.spec.js → oracle.spec.ts} +19 -17
- package/src/integrations/tests/{postgres.spec.js → postgres.spec.ts} +19 -17
- package/src/integrations/tests/{redis.spec.js → redis.spec.ts} +27 -18
- package/src/integrations/tests/{rest.spec.js → rest.spec.ts} +22 -14
- package/src/integrations/tests/{s3.spec.js → s3.spec.ts} +10 -8
- package/src/integrations/tests/{sql.spec.js → sql.spec.ts} +228 -177
- package/src/middleware/currentapp.js +2 -0
- package/src/migrations/functions/backfill/global.ts +0 -3
- package/src/migrations/index.ts +0 -16
- package/src/module.d.ts +2 -0
- package/src/tests/utilities/TestConfiguration.js +1 -1
- package/src/threads/query.ts +2 -2
- package/src/utilities/fileSystem/index.js +123 -0
- package/src/utilities/workerRequests.js +8 -0
- package/src/watch.ts +38 -0
- package/src/websocket.ts +26 -0
- package/builder/assets/index.8d12d461.css +0 -6
- package/builder/assets/index.d354271c.js +0 -879
- package/builder/assets/vendor.5e1fe644.css +0 -1
- package/builder/assets/vendor.67dbd8fa.js +0 -248
- package/coverage/lcov-report/api/controllers/component.js.html +0 -199
- package/coverage/lcov-report/api/controllers/screen.js.html +0 -259
- package/dist/migrations/functions/developerQuota.js +0 -49
- package/src/api/controllers/component.js +0 -38
- package/src/api/controllers/screen.js +0 -58
- package/src/migrations/functions/developerQuota.ts +0 -15
- package/src/migrations/functions/publishedAppsQuota.ts +0 -13
- package/src/migrations/functions/usageQuotas/syncDevelopers.ts +0 -19
- package/src/migrations/functions/usageQuotas/syncPublishedApps.ts +0 -21
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
const mongo = require("mongodb")
|
|
2
|
-
|
|
2
|
+
import { default as MongoDBIntegration } from "../mongodb"
|
|
3
3
|
jest.mock("mongodb")
|
|
4
4
|
|
|
5
5
|
class TestConfiguration {
|
|
6
|
-
|
|
6
|
+
integration: any
|
|
7
|
+
|
|
8
|
+
constructor(config: any = {}) {
|
|
7
9
|
this.integration = new MongoDBIntegration.integration(config)
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
function disableConsole() {
|
|
12
14
|
jest.spyOn(console, "error")
|
|
15
|
+
// @ts-ignore
|
|
13
16
|
console.error.mockImplementation(() => {})
|
|
14
17
|
|
|
18
|
+
// @ts-ignore
|
|
15
19
|
return console.error.mockRestore
|
|
16
20
|
}
|
|
17
21
|
|
|
18
22
|
describe("MongoDB Integration", () => {
|
|
19
|
-
let config
|
|
23
|
+
let config: any
|
|
20
24
|
let indexName = "Users"
|
|
21
25
|
|
|
22
26
|
beforeEach(() => {
|
|
@@ -54,13 +58,16 @@ describe("MongoDB Integration", () => {
|
|
|
54
58
|
id: "test",
|
|
55
59
|
},
|
|
56
60
|
options: {
|
|
57
|
-
opt: "option"
|
|
58
|
-
}
|
|
61
|
+
opt: "option",
|
|
62
|
+
},
|
|
59
63
|
},
|
|
60
64
|
extra: { collection: "testCollection", actionTypes: "deleteOne" },
|
|
61
65
|
}
|
|
62
66
|
await config.integration.delete(query)
|
|
63
|
-
expect(config.integration.client.deleteOne).toHaveBeenCalledWith(
|
|
67
|
+
expect(config.integration.client.deleteOne).toHaveBeenCalledWith(
|
|
68
|
+
query.json.filter,
|
|
69
|
+
query.json.options
|
|
70
|
+
)
|
|
64
71
|
})
|
|
65
72
|
|
|
66
73
|
it("calls the update method with the correct params", async () => {
|
|
@@ -108,7 +115,7 @@ describe("MongoDB Integration", () => {
|
|
|
108
115
|
json: {
|
|
109
116
|
filter: {
|
|
110
117
|
_id: "ObjectId('ACBD12345678ABCD12345678')",
|
|
111
|
-
name: "ObjectId('BBBB12345678ABCD12345678')"
|
|
118
|
+
name: "ObjectId('BBBB12345678ABCD12345678')",
|
|
112
119
|
},
|
|
113
120
|
update: {
|
|
114
121
|
_id: "ObjectId('FFFF12345678ABCD12345678')",
|
|
@@ -122,7 +129,7 @@ describe("MongoDB Integration", () => {
|
|
|
122
129
|
}
|
|
123
130
|
await config.integration.update(query)
|
|
124
131
|
expect(config.integration.client.updateOne).toHaveBeenCalled()
|
|
125
|
-
|
|
132
|
+
|
|
126
133
|
const args = config.integration.client.updateOne.mock.calls[0]
|
|
127
134
|
expect(args[0]).toEqual({
|
|
128
135
|
_id: mongo.ObjectID.createFromHexString("ACBD12345678ABCD12345678"),
|
|
@@ -133,7 +140,7 @@ describe("MongoDB Integration", () => {
|
|
|
133
140
|
name: mongo.ObjectID.createFromHexString("CCCC12345678ABCD12345678"),
|
|
134
141
|
})
|
|
135
142
|
expect(args[2]).toEqual({
|
|
136
|
-
upsert: false
|
|
143
|
+
upsert: false,
|
|
137
144
|
})
|
|
138
145
|
})
|
|
139
146
|
|
|
@@ -143,7 +150,7 @@ describe("MongoDB Integration", () => {
|
|
|
143
150
|
filter: {
|
|
144
151
|
_id: {
|
|
145
152
|
$eq: "ObjectId('ACBD12345678ABCD12345678')",
|
|
146
|
-
}
|
|
153
|
+
},
|
|
147
154
|
},
|
|
148
155
|
update: {
|
|
149
156
|
$set: {
|
|
@@ -158,20 +165,20 @@ describe("MongoDB Integration", () => {
|
|
|
158
165
|
}
|
|
159
166
|
await config.integration.update(query)
|
|
160
167
|
expect(config.integration.client.updateOne).toHaveBeenCalled()
|
|
161
|
-
|
|
168
|
+
|
|
162
169
|
const args = config.integration.client.updateOne.mock.calls[0]
|
|
163
170
|
expect(args[0]).toEqual({
|
|
164
171
|
_id: {
|
|
165
172
|
$eq: mongo.ObjectID.createFromHexString("ACBD12345678ABCD12345678"),
|
|
166
|
-
}
|
|
173
|
+
},
|
|
167
174
|
})
|
|
168
175
|
expect(args[1]).toEqual({
|
|
169
176
|
$set: {
|
|
170
177
|
_id: mongo.ObjectID.createFromHexString("FFFF12345678ABCD12345678"),
|
|
171
|
-
}
|
|
178
|
+
},
|
|
172
179
|
})
|
|
173
180
|
expect(args[2]).toEqual({
|
|
174
|
-
upsert: true
|
|
181
|
+
upsert: true,
|
|
175
182
|
})
|
|
176
183
|
})
|
|
177
184
|
|
|
@@ -181,12 +188,12 @@ describe("MongoDB Integration", () => {
|
|
|
181
188
|
filter: {
|
|
182
189
|
_id: {
|
|
183
190
|
$eq: "ObjectId('ACBD12345678ABCD12345678')",
|
|
184
|
-
}
|
|
191
|
+
},
|
|
185
192
|
},
|
|
186
193
|
update: {
|
|
187
194
|
$set: {
|
|
188
195
|
name: "UPDATED",
|
|
189
|
-
age: 99
|
|
196
|
+
age: 99,
|
|
190
197
|
},
|
|
191
198
|
},
|
|
192
199
|
options: {
|
|
@@ -197,21 +204,21 @@ describe("MongoDB Integration", () => {
|
|
|
197
204
|
}
|
|
198
205
|
await config.integration.read(query)
|
|
199
206
|
expect(config.integration.client.findOneAndUpdate).toHaveBeenCalled()
|
|
200
|
-
|
|
207
|
+
|
|
201
208
|
const args = config.integration.client.findOneAndUpdate.mock.calls[0]
|
|
202
209
|
expect(args[0]).toEqual({
|
|
203
210
|
_id: {
|
|
204
211
|
$eq: mongo.ObjectID.createFromHexString("ACBD12345678ABCD12345678"),
|
|
205
|
-
}
|
|
212
|
+
},
|
|
206
213
|
})
|
|
207
214
|
expect(args[1]).toEqual({
|
|
208
215
|
$set: {
|
|
209
216
|
name: "UPDATED",
|
|
210
|
-
age: 99
|
|
211
|
-
}
|
|
217
|
+
age: 99,
|
|
218
|
+
},
|
|
212
219
|
})
|
|
213
220
|
expect(args[2]).toEqual({
|
|
214
|
-
upsert: false
|
|
221
|
+
upsert: false,
|
|
215
222
|
})
|
|
216
223
|
})
|
|
217
224
|
|
|
@@ -242,12 +249,12 @@ describe("MongoDB Integration", () => {
|
|
|
242
249
|
}
|
|
243
250
|
await config.integration.update(query)
|
|
244
251
|
expect(config.integration.client.updateOne).toHaveBeenCalled()
|
|
245
|
-
|
|
252
|
+
|
|
246
253
|
const args = config.integration.client.updateOne.mock.calls[0]
|
|
247
254
|
expect(args[0]).toEqual({
|
|
248
255
|
_id: {
|
|
249
256
|
$eq: mongo.ObjectID.createFromHexString("ACBD12345678ABCD12345678"),
|
|
250
|
-
}
|
|
257
|
+
},
|
|
251
258
|
})
|
|
252
259
|
expect(args[1]).toEqual({
|
|
253
260
|
$set: {
|
|
@@ -255,15 +262,17 @@ describe("MongoDB Integration", () => {
|
|
|
255
262
|
data: [
|
|
256
263
|
{ cid: 1 },
|
|
257
264
|
{ cid: 2 },
|
|
258
|
-
{
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
265
|
+
{
|
|
266
|
+
nested: {
|
|
267
|
+
name: "test",
|
|
268
|
+
},
|
|
269
|
+
},
|
|
270
|
+
],
|
|
262
271
|
},
|
|
263
272
|
},
|
|
264
273
|
})
|
|
265
274
|
expect(args[2]).toEqual({
|
|
266
|
-
upsert: true
|
|
275
|
+
upsert: true,
|
|
267
276
|
})
|
|
268
277
|
})
|
|
269
278
|
|
|
@@ -295,12 +304,12 @@ describe("MongoDB Integration", () => {
|
|
|
295
304
|
}
|
|
296
305
|
await config.integration.update(query)
|
|
297
306
|
expect(config.integration.client.updateOne).toHaveBeenCalled()
|
|
298
|
-
|
|
307
|
+
|
|
299
308
|
const args = config.integration.client.updateOne.mock.calls[0]
|
|
300
309
|
expect(args[0]).toEqual({
|
|
301
310
|
_id: {
|
|
302
311
|
$eq: mongo.ObjectID.createFromHexString("ACBD12345678ABCD12345678"),
|
|
303
|
-
}
|
|
312
|
+
},
|
|
304
313
|
})
|
|
305
314
|
expect(args[1]).toEqual({
|
|
306
315
|
$set: {
|
|
@@ -308,16 +317,18 @@ describe("MongoDB Integration", () => {
|
|
|
308
317
|
data: [
|
|
309
318
|
{ cid: 1 },
|
|
310
319
|
{ cid: 2 },
|
|
311
|
-
{
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
320
|
+
{
|
|
321
|
+
nested: {
|
|
322
|
+
name: "te}st",
|
|
323
|
+
},
|
|
324
|
+
},
|
|
325
|
+
],
|
|
315
326
|
},
|
|
316
327
|
},
|
|
317
328
|
})
|
|
318
329
|
expect(args[2]).toEqual({
|
|
319
330
|
upsert: true,
|
|
320
|
-
extra:
|
|
331
|
+
extra: 'ad"{"d',
|
|
321
332
|
})
|
|
322
333
|
})
|
|
323
334
|
})
|
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
import { default as MySQLIntegration } from "../mysql"
|
|
2
2
|
jest.mock("mysql2")
|
|
3
3
|
|
|
4
4
|
class TestConfiguration {
|
|
5
|
-
|
|
5
|
+
integration: any
|
|
6
|
+
|
|
7
|
+
constructor(config: any = { ssl: {} }) {
|
|
6
8
|
this.integration = new MySQLIntegration.integration(config)
|
|
7
9
|
}
|
|
8
10
|
}
|
|
9
11
|
|
|
10
12
|
describe("MySQL Integration", () => {
|
|
11
|
-
let config
|
|
13
|
+
let config: any
|
|
12
14
|
|
|
13
15
|
beforeEach(() => {
|
|
14
16
|
config = new TestConfiguration()
|
|
@@ -17,7 +19,7 @@ describe("MySQL Integration", () => {
|
|
|
17
19
|
it("calls the create method with the correct params", async () => {
|
|
18
20
|
const sql = "insert into users (name, age) values ('Joe', 123);"
|
|
19
21
|
await config.integration.create({
|
|
20
|
-
sql
|
|
22
|
+
sql,
|
|
21
23
|
})
|
|
22
24
|
expect(config.integration.client.query).toHaveBeenCalledWith(sql, [])
|
|
23
25
|
})
|
|
@@ -25,7 +27,7 @@ describe("MySQL Integration", () => {
|
|
|
25
27
|
it("calls the read method with the correct params", async () => {
|
|
26
28
|
const sql = "select * from users;"
|
|
27
29
|
await config.integration.read({
|
|
28
|
-
sql
|
|
30
|
+
sql,
|
|
29
31
|
})
|
|
30
32
|
expect(config.integration.client.query).toHaveBeenCalledWith(sql, [])
|
|
31
33
|
})
|
|
@@ -33,7 +35,7 @@ describe("MySQL Integration", () => {
|
|
|
33
35
|
it("calls the update method with the correct params", async () => {
|
|
34
36
|
const sql = "update table users set name = 'test';"
|
|
35
37
|
await config.integration.update({
|
|
36
|
-
sql
|
|
38
|
+
sql,
|
|
37
39
|
})
|
|
38
40
|
expect(config.integration.client.query).toHaveBeenCalledWith(sql, [])
|
|
39
41
|
})
|
|
@@ -41,34 +43,34 @@ describe("MySQL Integration", () => {
|
|
|
41
43
|
it("calls the delete method with the correct params", async () => {
|
|
42
44
|
const sql = "delete from users where name = 'todelete';"
|
|
43
45
|
await config.integration.delete({
|
|
44
|
-
sql
|
|
46
|
+
sql,
|
|
45
47
|
})
|
|
46
48
|
expect(config.integration.client.query).toHaveBeenCalledWith(sql, [])
|
|
47
49
|
})
|
|
48
50
|
|
|
49
51
|
describe("no rows returned", () => {
|
|
50
52
|
it("returns the correct response when the create response has no rows", async () => {
|
|
51
|
-
|
|
52
|
-
const response = await config.integration.create({
|
|
53
|
-
sql
|
|
53
|
+
const sql = "insert into users (name, age) values ('Joe', 123);"
|
|
54
|
+
const response = await config.integration.create({
|
|
55
|
+
sql,
|
|
54
56
|
})
|
|
55
57
|
expect(response).toEqual([{ created: true }])
|
|
56
58
|
})
|
|
57
59
|
|
|
58
60
|
it("returns the correct response when the update response has no rows", async () => {
|
|
59
61
|
const sql = "update table users set name = 'test';"
|
|
60
|
-
const response = await config.integration.update({
|
|
61
|
-
sql
|
|
62
|
+
const response = await config.integration.update({
|
|
63
|
+
sql,
|
|
62
64
|
})
|
|
63
65
|
expect(response).toEqual([{ updated: true }])
|
|
64
66
|
})
|
|
65
67
|
|
|
66
68
|
it("returns the correct response when the delete response has no rows", async () => {
|
|
67
69
|
const sql = "delete from users where name = 'todelete';"
|
|
68
|
-
const response = await config.integration.delete({
|
|
69
|
-
sql
|
|
70
|
+
const response = await config.integration.delete({
|
|
71
|
+
sql,
|
|
70
72
|
})
|
|
71
73
|
expect(response).toEqual([{ deleted: true }])
|
|
72
74
|
})
|
|
73
75
|
})
|
|
74
|
-
})
|
|
76
|
+
})
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
const oracledb = require("oracledb")
|
|
2
|
-
|
|
2
|
+
import { default as OracleIntegration } from "../oracle"
|
|
3
3
|
jest.mock("oracledb")
|
|
4
4
|
|
|
5
5
|
class TestConfiguration {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
integration: any
|
|
7
|
+
|
|
8
|
+
constructor(config: any = {}) {
|
|
9
|
+
this.integration = new OracleIntegration.integration(config)
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
const options = { autoCommit: true }
|
|
12
14
|
|
|
13
15
|
describe("Oracle Integration", () => {
|
|
14
|
-
let config
|
|
16
|
+
let config: any
|
|
15
17
|
|
|
16
18
|
beforeEach(() => {
|
|
17
19
|
jest.clearAllMocks()
|
|
@@ -26,7 +28,7 @@ describe("Oracle Integration", () => {
|
|
|
26
28
|
it("calls the create method with the correct params", async () => {
|
|
27
29
|
const sql = "insert into users (name, age) values ('Joe', 123);"
|
|
28
30
|
await config.integration.create({
|
|
29
|
-
sql
|
|
31
|
+
sql,
|
|
30
32
|
})
|
|
31
33
|
expect(oracledb.executeMock).toHaveBeenCalledWith(sql, [], options)
|
|
32
34
|
expect(oracledb.executeMock).toHaveBeenCalledTimes(1)
|
|
@@ -35,7 +37,7 @@ describe("Oracle Integration", () => {
|
|
|
35
37
|
it("calls the read method with the correct params", async () => {
|
|
36
38
|
const sql = "select * from users;"
|
|
37
39
|
await config.integration.read({
|
|
38
|
-
sql
|
|
40
|
+
sql,
|
|
39
41
|
})
|
|
40
42
|
expect(oracledb.executeMock).toHaveBeenCalledWith(sql, [], options)
|
|
41
43
|
expect(oracledb.executeMock).toHaveBeenCalledTimes(1)
|
|
@@ -43,8 +45,8 @@ describe("Oracle Integration", () => {
|
|
|
43
45
|
|
|
44
46
|
it("calls the update method with the correct params", async () => {
|
|
45
47
|
const sql = "update table users set name = 'test';"
|
|
46
|
-
const response = await config.integration.update({
|
|
47
|
-
sql
|
|
48
|
+
const response = await config.integration.update({
|
|
49
|
+
sql,
|
|
48
50
|
})
|
|
49
51
|
expect(oracledb.executeMock).toHaveBeenCalledWith(sql, [], options)
|
|
50
52
|
expect(oracledb.executeMock).toHaveBeenCalledTimes(1)
|
|
@@ -53,7 +55,7 @@ describe("Oracle Integration", () => {
|
|
|
53
55
|
it("calls the delete method with the correct params", async () => {
|
|
54
56
|
const sql = "delete from users where name = 'todelete';"
|
|
55
57
|
await config.integration.delete({
|
|
56
|
-
sql
|
|
58
|
+
sql,
|
|
57
59
|
})
|
|
58
60
|
expect(oracledb.executeMock).toHaveBeenCalledWith(sql, [], options)
|
|
59
61
|
expect(oracledb.executeMock).toHaveBeenCalledTimes(1)
|
|
@@ -65,9 +67,9 @@ describe("Oracle Integration", () => {
|
|
|
65
67
|
})
|
|
66
68
|
|
|
67
69
|
it("returns the correct response when the create response has no rows", async () => {
|
|
68
|
-
|
|
69
|
-
const response = await config.integration.create({
|
|
70
|
-
sql
|
|
70
|
+
const sql = "insert into users (name, age) values ('Joe', 123);"
|
|
71
|
+
const response = await config.integration.create({
|
|
72
|
+
sql,
|
|
71
73
|
})
|
|
72
74
|
expect(response).toEqual([{ created: true }])
|
|
73
75
|
expect(oracledb.executeMock).toHaveBeenCalledTimes(1)
|
|
@@ -75,8 +77,8 @@ describe("Oracle Integration", () => {
|
|
|
75
77
|
|
|
76
78
|
it("returns the correct response when the update response has no rows", async () => {
|
|
77
79
|
const sql = "update table users set name = 'test';"
|
|
78
|
-
const response = await config.integration.update({
|
|
79
|
-
sql
|
|
80
|
+
const response = await config.integration.update({
|
|
81
|
+
sql,
|
|
80
82
|
})
|
|
81
83
|
expect(response).toEqual([{ updated: true }])
|
|
82
84
|
expect(oracledb.executeMock).toHaveBeenCalledTimes(1)
|
|
@@ -84,11 +86,11 @@ describe("Oracle Integration", () => {
|
|
|
84
86
|
|
|
85
87
|
it("returns the correct response when the delete response has no rows", async () => {
|
|
86
88
|
const sql = "delete from users where name = 'todelete';"
|
|
87
|
-
const response = await config.integration.delete({
|
|
88
|
-
sql
|
|
89
|
+
const response = await config.integration.delete({
|
|
90
|
+
sql,
|
|
89
91
|
})
|
|
90
92
|
expect(response).toEqual([{ deleted: true }])
|
|
91
93
|
expect(oracledb.executeMock).toHaveBeenCalledTimes(1)
|
|
92
94
|
})
|
|
93
95
|
})
|
|
94
|
-
})
|
|
96
|
+
})
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
const pg = require("pg")
|
|
2
|
-
|
|
2
|
+
import { default as PostgresIntegration } from "../postgres"
|
|
3
3
|
jest.mock("pg")
|
|
4
4
|
|
|
5
5
|
class TestConfiguration {
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
integration: any
|
|
7
|
+
|
|
8
|
+
constructor(config: any = {}) {
|
|
9
|
+
this.integration = new PostgresIntegration.integration(config)
|
|
8
10
|
}
|
|
9
11
|
}
|
|
10
12
|
|
|
11
13
|
describe("Postgres Integration", () => {
|
|
12
|
-
let config
|
|
14
|
+
let config: any
|
|
13
15
|
|
|
14
16
|
beforeEach(() => {
|
|
15
17
|
config = new TestConfiguration()
|
|
@@ -18,7 +20,7 @@ describe("Postgres Integration", () => {
|
|
|
18
20
|
it("calls the create method with the correct params", async () => {
|
|
19
21
|
const sql = "insert into users (name, age) values ('Joe', 123);"
|
|
20
22
|
await config.integration.create({
|
|
21
|
-
sql
|
|
23
|
+
sql,
|
|
22
24
|
})
|
|
23
25
|
expect(pg.queryMock).toHaveBeenCalledWith(sql, [])
|
|
24
26
|
})
|
|
@@ -26,15 +28,15 @@ describe("Postgres Integration", () => {
|
|
|
26
28
|
it("calls the read method with the correct params", async () => {
|
|
27
29
|
const sql = "select * from users;"
|
|
28
30
|
await config.integration.read({
|
|
29
|
-
sql
|
|
31
|
+
sql,
|
|
30
32
|
})
|
|
31
33
|
expect(pg.queryMock).toHaveBeenCalledWith(sql, [])
|
|
32
34
|
})
|
|
33
35
|
|
|
34
36
|
it("calls the update method with the correct params", async () => {
|
|
35
37
|
const sql = "update table users set name = 'test';"
|
|
36
|
-
const response = await config.integration.update({
|
|
37
|
-
sql
|
|
38
|
+
const response = await config.integration.update({
|
|
39
|
+
sql,
|
|
38
40
|
})
|
|
39
41
|
expect(pg.queryMock).toHaveBeenCalledWith(sql, [])
|
|
40
42
|
})
|
|
@@ -42,7 +44,7 @@ describe("Postgres Integration", () => {
|
|
|
42
44
|
it("calls the delete method with the correct params", async () => {
|
|
43
45
|
const sql = "delete from users where name = 'todelete';"
|
|
44
46
|
await config.integration.delete({
|
|
45
|
-
sql
|
|
47
|
+
sql,
|
|
46
48
|
})
|
|
47
49
|
expect(pg.queryMock).toHaveBeenCalledWith(sql, [])
|
|
48
50
|
})
|
|
@@ -53,27 +55,27 @@ describe("Postgres Integration", () => {
|
|
|
53
55
|
})
|
|
54
56
|
|
|
55
57
|
it("returns the correct response when the create response has no rows", async () => {
|
|
56
|
-
|
|
57
|
-
const response = await config.integration.create({
|
|
58
|
-
sql
|
|
58
|
+
const sql = "insert into users (name, age) values ('Joe', 123);"
|
|
59
|
+
const response = await config.integration.create({
|
|
60
|
+
sql,
|
|
59
61
|
})
|
|
60
62
|
expect(response).toEqual([{ created: true }])
|
|
61
63
|
})
|
|
62
64
|
|
|
63
65
|
it("returns the correct response when the update response has no rows", async () => {
|
|
64
66
|
const sql = "update table users set name = 'test';"
|
|
65
|
-
const response = await config.integration.update({
|
|
66
|
-
sql
|
|
67
|
+
const response = await config.integration.update({
|
|
68
|
+
sql,
|
|
67
69
|
})
|
|
68
70
|
expect(response).toEqual([{ updated: true }])
|
|
69
71
|
})
|
|
70
72
|
|
|
71
73
|
it("returns the correct response when the delete response has no rows", async () => {
|
|
72
74
|
const sql = "delete from users where name = 'todelete';"
|
|
73
|
-
const response = await config.integration.delete({
|
|
74
|
-
sql
|
|
75
|
+
const response = await config.integration.delete({
|
|
76
|
+
sql,
|
|
75
77
|
})
|
|
76
78
|
expect(response).toEqual([{ deleted: true }])
|
|
77
79
|
})
|
|
78
80
|
})
|
|
79
|
-
})
|
|
81
|
+
})
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
const Redis = require("ioredis-mock")
|
|
2
|
-
|
|
2
|
+
import { default as RedisIntegration } from "../redis"
|
|
3
3
|
|
|
4
4
|
class TestConfiguration {
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
integration: any
|
|
6
|
+
redis: any
|
|
7
|
+
|
|
8
|
+
constructor(config: any = {}) {
|
|
9
|
+
this.integration = new RedisIntegration.integration(config)
|
|
7
10
|
this.redis = new Redis({
|
|
8
11
|
data: {
|
|
9
|
-
test:
|
|
10
|
-
result: "1"
|
|
12
|
+
test: "test",
|
|
13
|
+
result: "1",
|
|
11
14
|
},
|
|
12
15
|
})
|
|
13
16
|
this.integration.client = this.redis
|
|
@@ -15,7 +18,7 @@ class TestConfiguration {
|
|
|
15
18
|
}
|
|
16
19
|
|
|
17
20
|
describe("Redis Integration", () => {
|
|
18
|
-
let config
|
|
21
|
+
let config: any
|
|
19
22
|
|
|
20
23
|
beforeEach(() => {
|
|
21
24
|
config = new TestConfiguration()
|
|
@@ -24,15 +27,15 @@ describe("Redis Integration", () => {
|
|
|
24
27
|
it("calls the create method with the correct params", async () => {
|
|
25
28
|
const body = {
|
|
26
29
|
key: "key",
|
|
27
|
-
value: "value"
|
|
30
|
+
value: "value",
|
|
28
31
|
}
|
|
29
|
-
|
|
32
|
+
await config.integration.create(body)
|
|
30
33
|
expect(await config.redis.get("key")).toEqual("value")
|
|
31
34
|
})
|
|
32
35
|
|
|
33
36
|
it("calls the read method with the correct params", async () => {
|
|
34
37
|
const body = {
|
|
35
|
-
key: "test"
|
|
38
|
+
key: "test",
|
|
36
39
|
}
|
|
37
40
|
const response = await config.integration.read(body)
|
|
38
41
|
expect(response).toEqual("test")
|
|
@@ -40,7 +43,7 @@ describe("Redis Integration", () => {
|
|
|
40
43
|
|
|
41
44
|
it("calls the delete method with the correct params", async () => {
|
|
42
45
|
const body = {
|
|
43
|
-
key: "test"
|
|
46
|
+
key: "test",
|
|
44
47
|
}
|
|
45
48
|
await config.integration.delete(body)
|
|
46
49
|
expect(await config.redis.get(body.key)).toEqual(null)
|
|
@@ -48,28 +51,34 @@ describe("Redis Integration", () => {
|
|
|
48
51
|
|
|
49
52
|
it("calls the pipeline method with the correct params", async () => {
|
|
50
53
|
const body = {
|
|
51
|
-
json: "KEYS *"
|
|
54
|
+
json: "KEYS *",
|
|
52
55
|
}
|
|
53
56
|
|
|
54
57
|
// ioredis-mock doesn't support pipelines
|
|
55
|
-
config.integration.client.pipeline = jest.fn(() => ({
|
|
58
|
+
config.integration.client.pipeline = jest.fn(() => ({
|
|
59
|
+
exec: jest.fn(() => [[]]),
|
|
60
|
+
}))
|
|
56
61
|
|
|
57
62
|
await config.integration.command(body)
|
|
58
|
-
expect(config.integration.client.pipeline).toHaveBeenCalledWith([
|
|
63
|
+
expect(config.integration.client.pipeline).toHaveBeenCalledWith([
|
|
64
|
+
["keys", "*"],
|
|
65
|
+
])
|
|
59
66
|
})
|
|
60
67
|
|
|
61
68
|
it("calls the pipeline method with several separated commands when there are newlines", async () => {
|
|
62
69
|
const body = {
|
|
63
|
-
json: 'SET foo "bar"\nGET foo'
|
|
70
|
+
json: 'SET foo "bar"\nGET foo',
|
|
64
71
|
}
|
|
65
72
|
|
|
66
73
|
// ioredis-mock doesn't support pipelines
|
|
67
|
-
config.integration.client.pipeline = jest.fn(() => ({
|
|
74
|
+
config.integration.client.pipeline = jest.fn(() => ({
|
|
75
|
+
exec: jest.fn(() => [[]]),
|
|
76
|
+
}))
|
|
68
77
|
|
|
69
78
|
await config.integration.command(body)
|
|
70
79
|
expect(config.integration.client.pipeline).toHaveBeenCalledWith([
|
|
71
|
-
["set",
|
|
72
|
-
["get",
|
|
80
|
+
["set", "foo", '"bar"'],
|
|
81
|
+
["get", "foo"],
|
|
73
82
|
])
|
|
74
83
|
})
|
|
75
|
-
})
|
|
84
|
+
})
|