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