@defra/grants-config-utils 0.2.1 → 0.4.0

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.
@@ -18,8 +18,11 @@ jobs:
18
18
  name: Run Pull Request Checks
19
19
  runs-on: ubuntu-latest
20
20
  steps:
21
- - uses: actions/checkout@v6
22
- - uses: actions/setup-node@v6
21
+ - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 #v6
22
+ with:
23
+ fetch-depth: 0
24
+
25
+ - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e #v6.4.0
23
26
  with:
24
27
  node-version-file: .nvmrc
25
28
  registry-url: "https://registry.npmjs.org/"
@@ -43,7 +46,7 @@ jobs:
43
46
  - name: SonarCloud Scan
44
47
  if: github.actor != 'dependabot[bot]' &&
45
48
  !startsWith(github.head_ref, 'changeset-release/')
46
- uses: SonarSource/sonarqube-scan-action@v8.1.0
49
+ uses: SonarSource/sonarqube-scan-action@7006c4492b2e0ee0f816d36501671557c97f5995 #8.1.0
47
50
  env:
48
51
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
49
52
  SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
@@ -25,13 +25,13 @@ jobs:
25
25
 
26
26
  steps:
27
27
  - name: Checkout repository
28
- uses: actions/checkout@v6
28
+ uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 #v6
29
29
  with:
30
30
  fetch-depth: 0
31
31
  fetch-tags: true
32
32
 
33
33
  - name: Set up Node.js
34
- uses: actions/setup-node@v6
34
+ uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e #v6.4.0
35
35
  with:
36
36
  node-version-file: .nvmrc
37
37
  registry-url: "https://registry.npmjs.org/"
@@ -44,7 +44,7 @@ jobs:
44
44
 
45
45
  - name: SonarCloud Scan
46
46
  if: github.actor != 'dependabot[bot]' && github.actor != 'github-actions[bot]' && !contains(github.event.head_commit.message, 'Create new config version')
47
- uses: SonarSource/sonarqube-scan-action@v8.1.0
47
+ uses: SonarSource/sonarqube-scan-action@7006c4492b2e0ee0f816d36501671557c97f5995 #8.1.0
48
48
  env:
49
49
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
50
50
  SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
@@ -54,7 +54,7 @@ jobs:
54
54
 
55
55
  - name: Create Release Pull Request or Release
56
56
  id: changesets
57
- uses: changesets/action@v1
57
+ uses: changesets/action@a45c4d594aa4e2c509dc14a9f2b3b67ba3780d0d #v1.9.0
58
58
  with:
59
59
  commitMode: 'github-api'
60
60
  publish: npm run github:release
@@ -63,7 +63,7 @@ jobs:
63
63
 
64
64
  - name: Trigger required checks on release PR, then merge to main, and delete release branch
65
65
  if: ${{ !startsWith(github.event_name == 'push' && github.event.head_commit.message || inputs.commit_message, 'Create new config version') }}
66
- uses: actions/github-script@v8
66
+ uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 #v9.0.0
67
67
  with:
68
68
  script: |
69
69
  const prNumber = Number("${{ steps.changesets.outputs.pullRequestNumber }}");
package/.husky/pre-commit CHANGED
@@ -1 +1,17 @@
1
1
  npx lint-staged
2
+
3
+ branch="$(git symbolic-ref --short HEAD)"
4
+ currentUser="$(git config user.name)"
5
+ if [ "$currentUser" != "github-actions[bot]" ]; then
6
+ if [ "$branch" = "main" ]; then
7
+ echo "❌ Pushing to main is not allowed!"
8
+ exit 1
9
+ fi
10
+ if git diff --name-only origin/HEAD...HEAD >/dev/null; then
11
+ if ! compgen -G ".changeset/*-*-*.md" > /dev/null; then
12
+ echo "❌ Make sure you have added a changeset file"
13
+ echo "Run: npm run version"
14
+ exit 1
15
+ fi
16
+ fi
17
+ fi
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # @defra/grants-config-utils
2
2
 
3
+ ## 0.4.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 63ff163: GRAN-60 - Add user to release config call (hardcoded for now)
8
+
9
+ ## 0.3.0
10
+
11
+ ### Minor Changes
12
+
13
+ - 3f948bf: feat(GRAN-8): Allow async contact with config-broker
14
+
15
+ Update actions versions
16
+ Add to pre-commit hook to ensure changeset added
17
+
3
18
  ## 0.2.1
4
19
 
5
20
  ### Patch Changes
package/README.md CHANGED
@@ -24,6 +24,16 @@ The following variables are used in this module:
24
24
  - `CONFIG_BUCKET_NAME` - **Required** The S3 bucket where the config is to be stored
25
25
  - `FORCE_PATH_STYLE` - Optional flag to force path style URLs when using S3 bucket (default true)
26
26
  - `AWS_ENDPOINT_URL` - Optional AWS endpoint URL for local development
27
+ - `GRANTS_CONFIG_PUBLISH_STATUS` - Optional override for status used on publish of config versions (default 'active')
28
+
29
+ Depending on which mechanism is used to publish config versions, the following environment variables may be required:
30
+
31
+ **To publish asynchronously via SNS (Recommended)**
32
+
33
+ - `GFR__SNS__CONFIG_VERSION_ARN` - **Required** ARN of the SNS topic to publish config version events to
34
+
35
+ **To publish synchronously via REST API**
36
+
27
37
  - `GRANTS_CONFIG_BROKER_AUTH_TOKEN` - **Required** Auth token for the grants config broker API
28
38
  - `GRANTS_CONFIG_BROKER_ENCRYPTION_KEY` - **Required** Encryption key for the grants config broker API
29
39
  - `GRANTS_CONFIG_BROKER_API_ENDPOINT` - **Required** Endpoint for the grants config broker API
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@defra/grants-config-utils",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "NPM module for providing utils for publishing grants config",
5
5
  "engines": {
6
6
  "node": ">=24",
@@ -2,6 +2,11 @@ import { readFileSync, existsSync, lstatSync, readdirSync } from "node:fs";
2
2
  import { config } from "../config/config.js";
3
3
  import { listFiles, uploadBlob } from "../s3/s3-interactions.js";
4
4
  import { createApiHeadersForConfigBroker } from "../broker/broker-auth-helper.js";
5
+ import {
6
+ isClientSetup,
7
+ publishMessage,
8
+ setupClient,
9
+ } from "../sns/sns-client.js";
5
10
 
6
11
  const configsDirectory = "configurations";
7
12
 
@@ -101,11 +106,13 @@ const notifyConfigBrokerServiceVersionAvailable = async (
101
106
  logger,
102
107
  ) => {
103
108
  const configBrokerEndpoint = config.get("configBroker.apiEndpoint");
109
+ const configSNSTopic = config.get("aws.sns.configVersionTopicArn");
104
110
  const configPublishStatus = config.get("configPublish.status");
105
111
 
106
112
  // iterate each grant configuration, notify config available at current service version
107
113
  for (const configAtServiceVersion of configsAtServiceVersion) {
108
114
  await sendConfigMessageToBroker(
115
+ configSNSTopic,
109
116
  configBrokerEndpoint,
110
117
  configAtServiceVersion,
111
118
  configPublishStatus,
@@ -115,30 +122,38 @@ const notifyConfigBrokerServiceVersionAvailable = async (
115
122
  };
116
123
 
117
124
  const sendConfigMessageToBroker = async (
125
+ configSNSTopic,
118
126
  configBrokerEndpoint,
119
127
  configAtServiceVersion,
120
128
  configPublishStatus,
121
129
  logger,
122
130
  ) => {
123
- // TODO BH check service topic set instead
124
- if (!configBrokerEndpoint?.length) {
125
- logger.warn(
126
- `config broker endpoint not set, so skipping release config call`,
127
- );
128
- return;
129
- }
130
-
131
131
  const { grant, version, files } = configAtServiceVersion;
132
132
  // files is an array of tuples, we only want the S3 paths here
133
133
  const s3Paths = files.map(([_, s3Path]) => s3Path);
134
134
 
135
+ // When CDP is updated to inject user that did deployment of container, reference that injected variable from config here
136
+ const user = "system";
137
+
135
138
  const payload = {
136
139
  grant,
137
140
  version,
138
141
  files: s3Paths,
139
142
  status: configPublishStatus,
143
+ user,
140
144
  };
141
145
 
146
+ if (setToUseSNS(configSNSTopic)) {
147
+ return sendViaSNS(payload, configSNSTopic, logger);
148
+ }
149
+
150
+ if (!configBrokerEndpoint?.length) {
151
+ logger.warn(
152
+ `config SNS topic not set, and config broker endpoint not set, so skipping release config call`,
153
+ );
154
+ return;
155
+ }
156
+
142
157
  const url = new URL(`/api/release-config`, configBrokerEndpoint);
143
158
  try {
144
159
  const response = await fetch(url.href, {
@@ -163,3 +178,26 @@ const sendConfigMessageToBroker = async (
163
178
  logger.error("call to release config failed", err);
164
179
  }
165
180
  };
181
+
182
+ const sendViaSNS = async (payload, configSNSTopic, logger) => {
183
+ if (!isClientSetup()) {
184
+ setupClient(logger.child({}), {
185
+ region: config.get("aws.region"),
186
+ endpoint: config.get("aws.endpointUrl"),
187
+ publishToTopic: config.get("aws.sns.configVersionTopicArn"),
188
+ });
189
+ }
190
+
191
+ await publishMessage(payload);
192
+
193
+ logger.info(
194
+ `successfully notified the config broker about '${payload.grant}' at version '${payload.version}' via SNS`,
195
+ );
196
+ };
197
+
198
+ const setToUseSNS = (configSNSTopic) => {
199
+ return (
200
+ configSNSTopic &&
201
+ configSNSTopic !== config.default("aws.sns.configVersionTopicArn")
202
+ );
203
+ };
@@ -1,6 +1,12 @@
1
1
  import { storeConfigVersionAndInformBroker } from "./config-store-and-inform.js";
2
2
  import { readFileSync, existsSync, lstatSync, readdirSync } from "node:fs";
3
3
  import { listFiles, uploadBlob } from "../s3/s3-interactions.js";
4
+ import {
5
+ isClientSetup,
6
+ publishMessage,
7
+ setupClient,
8
+ } from "../sns/sns-client.js";
9
+ import { config } from "../config/config.js";
4
10
 
5
11
  vi.mock("node:fs", () => ({
6
12
  existsSync: vi.fn(),
@@ -9,20 +15,6 @@ vi.mock("node:fs", () => ({
9
15
  readFileSync: vi.fn(() => "file-content"),
10
16
  }));
11
17
 
12
- vi.mock("../config/config.js", () => ({
13
- config: {
14
- get: (key) => {
15
- const values = {
16
- serviceVersion: "1.2.3",
17
- serviceName: "grants-config-playground",
18
- "configBroker.apiEndpoint": "https://broker.unit.test",
19
- "configPublish.status": "active",
20
- };
21
- return values[key];
22
- },
23
- },
24
- }));
25
-
26
18
  vi.mock("../s3/s3-interactions.js", () => ({
27
19
  listFiles: vi.fn(() => []),
28
20
  uploadBlob: vi.fn(),
@@ -34,10 +26,13 @@ vi.mock("../broker/broker-auth-helper.js", () => ({
34
26
  })),
35
27
  }));
36
28
 
29
+ vi.mock("../sns/sns-client.js");
30
+
37
31
  const mockLogger = {
38
32
  info: vi.fn(),
39
33
  warn: vi.fn(),
40
34
  error: vi.fn(),
35
+ child: vi.fn(() => mockLogger),
41
36
  };
42
37
 
43
38
  describe("storeConfigVersionAndInformBroker", () => {
@@ -56,6 +51,15 @@ describe("storeConfigVersionAndInformBroker", () => {
56
51
  }),
57
52
  ),
58
53
  );
54
+
55
+ config.set("serviceVersion", "1.2.3");
56
+ config.set("serviceName", "grants-config-playground");
57
+ config.set("configBroker.apiEndpoint", "https://broker.unit.test");
58
+ config.set("configPublish.status", "active");
59
+ config.set(
60
+ "aws.sns.configVersionTopicArn",
61
+ "arn:aws:sns:us-east-1:123456789012:config-version-topic",
62
+ );
59
63
  });
60
64
 
61
65
  afterEach(() => {
@@ -79,124 +83,173 @@ describe("storeConfigVersionAndInformBroker", () => {
79
83
  expect(fetch).not.toHaveBeenCalled();
80
84
  });
81
85
 
82
- it("should store config and inform config broker", async () => {
83
- existsSync.mockReturnValue(true);
84
- lstatSync.mockReturnValue({ isDirectory: () => true });
85
- readdirSync
86
- .mockReturnValueOnce([{ name: "grant-1", isDirectory: () => true }])
87
- .mockReturnValueOnce([
86
+ describe("when configurations exist", () => {
87
+ beforeEach(() => {
88
+ existsSync.mockReturnValue(true);
89
+ lstatSync.mockReturnValue({ isDirectory: () => true });
90
+ readdirSync
91
+ .mockReturnValueOnce([{ name: "grant-1", isDirectory: () => true }])
92
+ .mockReturnValueOnce([
93
+ {
94
+ name: "main.json",
95
+ isFile: () => true,
96
+ parentPath: "configurations/grant-1",
97
+ },
98
+ ]);
99
+ });
100
+
101
+ it("should store config and inform config broker via REST API if SNS not setup", async () => {
102
+ //reset topic to default, should indicate not setup
103
+ config.set(
104
+ "aws.sns.configVersionTopicArn",
105
+ config.default("aws.sns.configVersionTopicArn"),
106
+ );
107
+ await storeConfigVersionAndInformBroker(mockLogger);
108
+
109
+ expect(mockLogger.info).toHaveBeenCalledWith(
110
+ "uploading 'grant-1/1.2.3/main.json' to S3",
111
+ );
112
+ expect(mockLogger.info).toHaveBeenCalledWith(
113
+ "successfully uploaded '1' files across '1' configs",
114
+ );
115
+ expect(mockLogger.info).toHaveBeenCalledWith(
116
+ "successfully notified the config broker about 'grant-1' at version '1.2.3'",
117
+ );
118
+ expect(listFiles).toHaveBeenCalledTimes(1);
119
+ expect(readFileSync).toHaveBeenCalledTimes(1);
120
+ expect(uploadBlob).toHaveBeenCalledTimes(1);
121
+ expect(fetch).toHaveBeenCalledWith(
122
+ "https://broker.unit.test/api/release-config",
88
123
  {
89
- name: "main.json",
90
- isFile: () => true,
91
- parentPath: "configurations/grant-1",
124
+ method: "POST",
125
+ headers: {
126
+ "Content-Type": "application/json",
127
+ authorization: "Bearer token",
128
+ },
129
+ body: JSON.stringify({
130
+ grant: "grant-1",
131
+ version: "1.2.3",
132
+ files: ["grant-1/1.2.3/main.json"],
133
+ status: "active",
134
+ user: "system",
135
+ }),
92
136
  },
93
- ]);
94
-
95
- await storeConfigVersionAndInformBroker(mockLogger);
96
-
97
- expect(mockLogger.info).toHaveBeenCalledWith(
98
- "uploading 'grant-1/1.2.3/main.json' to S3",
99
- );
100
- expect(mockLogger.info).toHaveBeenCalledWith(
101
- "successfully uploaded '1' files across '1' configs",
102
- );
103
- expect(mockLogger.info).toHaveBeenCalledWith(
104
- "successfully notified the config broker about 'grant-1' at version '1.2.3'",
105
- );
106
- expect(listFiles).toHaveBeenCalledTimes(1);
107
- expect(readFileSync).toHaveBeenCalledTimes(1);
108
- expect(uploadBlob).toHaveBeenCalledTimes(1);
109
- expect(fetch).toHaveBeenCalledWith(
110
- "https://broker.unit.test/api/release-config",
111
- {
112
- method: "POST",
113
- headers: {
114
- "Content-Type": "application/json",
115
- authorization: "Bearer token",
116
- },
117
- body: JSON.stringify({
118
- grant: "grant-1",
119
- version: "1.2.3",
120
- files: ["grant-1/1.2.3/main.json"],
121
- status: "active",
122
- }),
123
- },
124
- );
125
- });
126
-
127
- it("should not store or inform when already published by config broker", async () => {
128
- existsSync.mockReturnValue(true);
129
- lstatSync.mockReturnValue({ isDirectory: () => true });
130
- readdirSync
131
- .mockReturnValueOnce([{ name: "grant-1", isDirectory: () => true }])
132
- .mockReturnValueOnce([
133
- {
134
- name: "main.json",
135
- isFile: () => true,
136
- parentPath: "configurations/grant-1",
137
- },
138
- ]);
139
- listFiles.mockReturnValueOnce([{ Contents: ["fake-content-1"] }]);
140
-
141
- await storeConfigVersionAndInformBroker(mockLogger);
142
-
143
- expect(listFiles).toHaveBeenCalledTimes(1);
144
- expect(readFileSync).not.toHaveBeenCalled();
145
- expect(uploadBlob).not.toHaveBeenCalled();
146
- expect(fetch).not.toHaveBeenCalled();
147
- });
148
-
149
- it("should call config broker for each config (subdirectory) found in configurations folder", async () => {
150
- existsSync.mockReturnValue(true);
151
- lstatSync.mockReturnValue({ isDirectory: () => true });
152
- readdirSync
153
- .mockReturnValueOnce([
154
- { name: "grant-1", isDirectory: () => true },
155
- { name: "grant-2", isDirectory: () => true },
156
- ])
157
- .mockReturnValueOnce([
158
- {
159
- name: "main.json",
160
- isFile: () => true,
161
- parentPath: "configurations/grant-1",
162
- },
163
- {
164
- name: "submain.json",
165
- isFile: () => true,
166
- parentPath: "configurations/grant-1",
167
- },
168
- ])
169
- .mockReturnValueOnce([
170
- {
171
- name: "main.json",
172
- isFile: () => true,
173
- parentPath: "configurations/grant-2",
174
- },
175
- ]);
176
-
177
- await storeConfigVersionAndInformBroker(mockLogger);
178
-
179
- expect(mockLogger.info).toHaveBeenCalledWith(
180
- "uploading 'grant-1/1.2.3/main.json' to S3",
181
- );
182
- expect(mockLogger.info).toHaveBeenCalledWith(
183
- "uploading 'grant-1/1.2.3/submain.json' to S3",
184
- );
185
- expect(mockLogger.info).toHaveBeenCalledWith(
186
- "uploading 'grant-2/1.2.3/main.json' to S3",
187
- );
188
- expect(mockLogger.info).toHaveBeenCalledWith(
189
- "successfully uploaded '3' files across '2' configs",
190
- );
191
- expect(mockLogger.info).toHaveBeenCalledWith(
192
- "successfully notified the config broker about 'grant-1' at version '1.2.3'",
193
- );
194
- expect(mockLogger.info).toHaveBeenCalledWith(
195
- "successfully notified the config broker about 'grant-2' at version '1.2.3'",
196
- );
197
- expect(listFiles).toHaveBeenCalledTimes(2);
198
- expect(readFileSync).toHaveBeenCalledTimes(3);
199
- expect(uploadBlob).toHaveBeenCalledTimes(3);
200
- expect(fetch).toHaveBeenCalledTimes(2);
137
+ );
138
+ });
139
+
140
+ it("should store config and inform config broker via SNS if setup", async () => {
141
+ await storeConfigVersionAndInformBroker(mockLogger);
142
+
143
+ expect(mockLogger.info).toHaveBeenCalledWith(
144
+ "uploading 'grant-1/1.2.3/main.json' to S3",
145
+ );
146
+ expect(mockLogger.info).toHaveBeenCalledWith(
147
+ "successfully uploaded '1' files across '1' configs",
148
+ );
149
+ expect(mockLogger.info).toHaveBeenCalledWith(
150
+ "successfully notified the config broker about 'grant-1' at version '1.2.3' via SNS",
151
+ );
152
+ expect(listFiles).toHaveBeenCalledTimes(1);
153
+ expect(readFileSync).toHaveBeenCalledTimes(1);
154
+ expect(uploadBlob).toHaveBeenCalledTimes(1);
155
+ expect(isClientSetup).toHaveBeenCalledTimes(1);
156
+ expect(setupClient).toHaveBeenCalledTimes(1);
157
+ expect(publishMessage).toHaveBeenCalledWith({
158
+ grant: "grant-1",
159
+ version: "1.2.3",
160
+ files: ["grant-1/1.2.3/main.json"],
161
+ status: "active",
162
+ user: "system",
163
+ });
164
+ });
165
+
166
+ it("should not store or inform when already published by config broker", async () => {
167
+ listFiles.mockReturnValueOnce([{ Contents: ["fake-content-1"] }]);
168
+
169
+ await storeConfigVersionAndInformBroker(mockLogger);
170
+
171
+ expect(listFiles).toHaveBeenCalledTimes(1);
172
+ expect(readFileSync).not.toHaveBeenCalled();
173
+ expect(uploadBlob).not.toHaveBeenCalled();
174
+ expect(fetch).not.toHaveBeenCalled();
175
+ });
176
+
177
+ it("should stop and print warning if no mechanism setup to contact config-broker", async () => {
178
+ config.set(
179
+ "aws.sns.configVersionTopicArn",
180
+ config.default("aws.sns.configVersionTopicArn"),
181
+ );
182
+ config.set("configBroker.apiEndpoint", "");
183
+
184
+ await storeConfigVersionAndInformBroker(mockLogger);
185
+
186
+ expect(mockLogger.warn).toHaveBeenCalledWith(
187
+ "config SNS topic not set, and config broker endpoint not set, so skipping release config call",
188
+ );
189
+
190
+ expect(listFiles).toHaveBeenCalledTimes(1);
191
+ expect(fetch).not.toHaveBeenCalled();
192
+ expect(isClientSetup).not.toHaveBeenCalled();
193
+ expect(setupClient).not.toHaveBeenCalled();
194
+ expect(publishMessage).not.toHaveBeenCalled();
195
+ });
196
+
197
+ it("should call config broker for each config (subdirectory) found in configurations folder", async () => {
198
+ //reset topic to default, should indicate not setup
199
+ config.set(
200
+ "aws.sns.configVersionTopicArn",
201
+ config.default("aws.sns.configVersionTopicArn"),
202
+ );
203
+ readdirSync.mockRestore();
204
+ readdirSync
205
+ .mockReturnValueOnce([
206
+ { name: "grant-1", isDirectory: () => true },
207
+ { name: "grant-2", isDirectory: () => true },
208
+ ])
209
+ .mockReturnValueOnce([
210
+ {
211
+ name: "main.json",
212
+ isFile: () => true,
213
+ parentPath: "configurations/grant-1",
214
+ },
215
+ {
216
+ name: "submain.json",
217
+ isFile: () => true,
218
+ parentPath: "configurations/grant-1",
219
+ },
220
+ ])
221
+ .mockReturnValueOnce([
222
+ {
223
+ name: "main.json",
224
+ isFile: () => true,
225
+ parentPath: "configurations/grant-2",
226
+ },
227
+ ]);
228
+
229
+ await storeConfigVersionAndInformBroker(mockLogger);
230
+
231
+ expect(mockLogger.info).toHaveBeenCalledWith(
232
+ "uploading 'grant-1/1.2.3/main.json' to S3",
233
+ );
234
+ expect(mockLogger.info).toHaveBeenCalledWith(
235
+ "uploading 'grant-1/1.2.3/submain.json' to S3",
236
+ );
237
+ expect(mockLogger.info).toHaveBeenCalledWith(
238
+ "uploading 'grant-2/1.2.3/main.json' to S3",
239
+ );
240
+ expect(mockLogger.info).toHaveBeenCalledWith(
241
+ "successfully uploaded '3' files across '2' configs",
242
+ );
243
+ expect(mockLogger.info).toHaveBeenCalledWith(
244
+ "successfully notified the config broker about 'grant-1' at version '1.2.3'",
245
+ );
246
+ expect(mockLogger.info).toHaveBeenCalledWith(
247
+ "successfully notified the config broker about 'grant-2' at version '1.2.3'",
248
+ );
249
+ expect(listFiles).toHaveBeenCalledTimes(2);
250
+ expect(readFileSync).toHaveBeenCalledTimes(3);
251
+ expect(uploadBlob).toHaveBeenCalledTimes(3);
252
+ expect(fetch).toHaveBeenCalledTimes(2);
253
+ });
201
254
  });
202
255
  });