Skip to content

Commit a9691f8

Browse files
committed
adding tests
1 parent f1fcc48 commit a9691f8

File tree

5 files changed

+29
-27
lines changed

5 files changed

+29
-27
lines changed

packages/b2c-cli/test/commands/scapi/replications/get.test.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -158,10 +158,10 @@ describe('scapi replications get', () => {
158158
const errorStub = sinon.stub(command, 'error').throws(new Error('Expected error'));
159159

160160
sinon.stub(globalThis, 'fetch').resolves(
161-
new Response(
162-
JSON.stringify({title: 'Not Found', detail: 'Process not found'}),
163-
{status: 404, headers: {'content-type': 'application/json'}},
164-
),
161+
new Response(JSON.stringify({title: 'Not Found', detail: 'Process not found'}), {
162+
status: 404,
163+
headers: {'content-type': 'application/json'},
164+
}),
165165
);
166166

167167
try {
@@ -184,10 +184,10 @@ describe('scapi replications get', () => {
184184
const errorStub = sinon.stub(command, 'error').throws(new Error('Expected error'));
185185

186186
sinon.stub(globalThis, 'fetch').resolves(
187-
new Response(
188-
JSON.stringify({title: 'Forbidden', detail: 'Feature not enabled'}),
189-
{status: 403, headers: {'content-type': 'application/json'}},
190-
),
187+
new Response(JSON.stringify({title: 'Forbidden', detail: 'Feature not enabled'}), {
188+
status: 403,
189+
headers: {'content-type': 'application/json'},
190+
}),
191191
);
192192

193193
try {

packages/b2c-cli/test/commands/scapi/replications/list.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -136,10 +136,10 @@ describe('scapi replications list', () => {
136136
const errorStub = sinon.stub(command, 'error').throws(new Error('Expected error'));
137137

138138
sinon.stub(globalThis, 'fetch').resolves(
139-
new Response(
140-
JSON.stringify({title: 'Forbidden', detail: 'Feature not enabled'}),
141-
{status: 403, headers: {'content-type': 'application/json'}},
142-
),
139+
new Response(JSON.stringify({title: 'Forbidden', detail: 'Feature not enabled'}), {
140+
status: 403,
141+
headers: {'content-type': 'application/json'},
142+
}),
143143
);
144144

145145
try {

packages/b2c-cli/test/commands/scapi/replications/publish.test.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -222,12 +222,14 @@ describe('scapi replications publish', () => {
222222
sinon.stub(command, 'getOAuthStrategy').returns({getAuthorizationHeader: async () => 'Bearer test'});
223223
const errorStub = sinon.stub(command, 'error').throws(new Error('Expected error'));
224224

225-
sinon.stub(globalThis, 'fetch').resolves(
226-
new Response(
227-
JSON.stringify({title: 'Conflict', detail: 'Cannot queue items while full replication is running'}),
228-
{status: 409, headers: {'content-type': 'application/json'}},
229-
),
230-
);
225+
sinon
226+
.stub(globalThis, 'fetch')
227+
.resolves(
228+
new Response(
229+
JSON.stringify({title: 'Conflict', detail: 'Cannot queue items while full replication is running'}),
230+
{status: 409, headers: {'content-type': 'application/json'}},
231+
),
232+
);
231233

232234
try {
233235
await command.run();

packages/b2c-cli/test/commands/scapi/replications/wait.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ describe('scapi replications wait', () => {
157157
try {
158158
await command.run();
159159
expect.fail('Should have thrown');
160-
} catch (error: any) {
160+
} catch {
161161
expect(errorStub.calledOnce).to.equal(true);
162162
}
163163
});
@@ -174,10 +174,10 @@ describe('scapi replications wait', () => {
174174
const errorStub = sinon.stub(command, 'error').throws(new Error('Expected error'));
175175

176176
sinon.stub(globalThis, 'fetch').resolves(
177-
new Response(
178-
JSON.stringify({title: 'Not Found', detail: 'Process not found'}),
179-
{status: 404, headers: {'content-type': 'application/json'}},
180-
),
177+
new Response(JSON.stringify({title: 'Not Found', detail: 'Process not found'}), {
178+
status: 404,
179+
headers: {'content-type': 'application/json'},
180+
}),
181181
);
182182

183183
try {

packages/b2c-tooling-sdk/test/clients/granular-replications.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ describe('Granular Replications Client', () => {
114114
it('should queue product for publishing', async () => {
115115
server.use(
116116
http.post(`${BASE_URL}/organizations/${ORG_ID}/granular-processes`, async ({request}) => {
117-
const body = (await request.json()) as any;
117+
const body = (await request.json()) as Record<string, unknown>;
118118
expect(body).to.deep.equal({product: {productId: 'PROD-1'}});
119119
return HttpResponse.json({id: 'proc-123'}, {status: 201});
120120
}),
@@ -132,7 +132,7 @@ describe('Granular Replications Client', () => {
132132
it('should queue price table for publishing', async () => {
133133
server.use(
134134
http.post(`${BASE_URL}/organizations/${ORG_ID}/granular-processes`, async ({request}) => {
135-
const body = (await request.json()) as any;
135+
const body = (await request.json()) as Record<string, unknown>;
136136
expect(body).to.deep.equal({priceTable: {priceTableId: 'table-1'}});
137137
return HttpResponse.json({id: 'proc-456'}, {status: 201});
138138
}),
@@ -149,7 +149,7 @@ describe('Granular Replications Client', () => {
149149
it('should queue private content asset for publishing', async () => {
150150
server.use(
151151
http.post(`${BASE_URL}/organizations/${ORG_ID}/granular-processes`, async ({request}) => {
152-
const body = (await request.json()) as any;
152+
const body = (await request.json()) as Record<string, unknown>;
153153
expect(body).to.deep.equal({
154154
contentAsset: {contentId: 'hero-banner', type: 'private', siteId: 'RefArch'},
155155
});
@@ -168,7 +168,7 @@ describe('Granular Replications Client', () => {
168168
it('should queue shared content asset for publishing', async () => {
169169
server.use(
170170
http.post(`${BASE_URL}/organizations/${ORG_ID}/granular-processes`, async ({request}) => {
171-
const body = (await request.json()) as any;
171+
const body = (await request.json()) as Record<string, unknown>;
172172
expect(body).to.deep.equal({
173173
contentAsset: {contentId: 'footer-links', type: 'shared', libraryId: 'SharedLibrary'},
174174
});

0 commit comments

Comments
 (0)