Skip to content

Commit 95c2200

Browse files
committed
fix tests after adding sandbox as required param
1 parent 359b2dd commit 95c2200

File tree

2 files changed

+20
-13
lines changed

2 files changed

+20
-13
lines changed

src/cmd/secrets.test.js

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ describe('SecretsCommand', () => {
101101

102102
await secretsCommand.list({ org: 'my-org' });
103103

104-
expect(secretsStub.list).to.have.been.calledWith({ org: 'my-org', api: secretsCommand.api });
104+
expect(secretsStub.list).to.have.been.calledWith({ org: 'my-org', api: secretsCommand.api, sandbox: undefined });
105105
expect(secretsCommand.ui.showBusySpinnerUntilResolved).to.have.been.calledWith('Retrieving secrets');
106106
});
107107

@@ -149,7 +149,8 @@ describe('SecretsCommand', () => {
149149
expect(secretsStub.get).to.have.been.calledWith({
150150
api: secretsCommand.api,
151151
name: 'MY_SECRET',
152-
org: undefined
152+
org: undefined,
153+
sandbox: true
153154
});
154155
expect(secretsCommand.ui.showBusySpinnerUntilResolved).to.have.been.calledWith('Retrieving secret');
155156
});
@@ -170,7 +171,8 @@ describe('SecretsCommand', () => {
170171
expect(secretsStub.get).to.have.been.calledWith({
171172
api: secretsCommand.api,
172173
name: 'ORG_SECRET',
173-
org: 'my-org'
174+
org: 'my-org',
175+
sandbox: undefined
174176
});
175177
});
176178
});
@@ -184,6 +186,7 @@ describe('SecretsCommand', () => {
184186
expect(secretsStub.remove).to.have.been.calledWith({
185187
api: secretsCommand.api,
186188
org: undefined,
189+
sandbox: true,
187190
name: 'MY_SECRET'
188191
});
189192
expect(secretsCommand.ui.write).to.have.been.calledWith('Secret MY_SECRET deleted successfully.');
@@ -197,6 +200,7 @@ describe('SecretsCommand', () => {
197200
expect(secretsStub.remove).to.have.been.calledWith({
198201
api: secretsCommand.api,
199202
org: 'my-org',
203+
sandbox: undefined,
200204
name: 'ORG_SECRET'
201205
});
202206
expect(secretsCommand.ui.write).to.have.been.calledWith('Secret ORG_SECRET deleted successfully.');
@@ -221,6 +225,7 @@ describe('SecretsCommand', () => {
221225
api: secretsCommand.api,
222226
name: 'MY_SECRET',
223227
org: undefined,
228+
sandbox: true,
224229
value: 'secret-value'
225230
});
226231
expect(secretsCommand.ui.write).to.have.been.calledWith('Secret MY_SECRET set successfully.');
@@ -243,6 +248,7 @@ describe('SecretsCommand', () => {
243248
api: secretsCommand.api,
244249
name: 'MY_SECRET',
245250
org: undefined,
251+
sandbox: true,
246252
value: 'secret-value'
247253
});
248254
});
@@ -264,6 +270,7 @@ describe('SecretsCommand', () => {
264270
api: secretsCommand.api,
265271
name: 'ORG_SECRET',
266272
org: 'my-org',
273+
sandbox: undefined,
267274
value: 'org-value'
268275
});
269276
});

src/lib/secrets.test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,15 @@ describe('secrets', () => {
2020
.intercept('/secrets', 'GET')
2121
.reply(200, emptySecretsList);
2222

23-
const secretsResponse = await secrets.list({ api });
23+
const secretsResponse = await secrets.list({ api, sandbox: true });
2424
expect(secretsResponse).to.deep.equal([]);
2525
});
2626

2727
it('returns a list of secrets', async () => {
2828
nock(baseUrl)
2929
.intercept('/secrets', 'GET')
3030
.reply(200, secretsList);
31-
const secretsResponse = await secrets.list({ api });
31+
const secretsResponse = await secrets.list({ api, sandbox: true });
3232
expect(secretsResponse).to.deep.equal(formattedSecretList);
3333
});
3434

@@ -51,7 +51,7 @@ describe('secrets', () => {
5151
nock(baseUrl)
5252
.intercept(`/secrets/${secret.name}`, 'PUT')
5353
.reply(200, secretGenericResponse);
54-
const secretResponse = await secrets.update({ api, ...secret });
54+
const secretResponse = await secrets.update({ api, ...secret, sandbox: true });
5555
expect(secretResponse).to.deep.equal(formattedGenericSecretGet);
5656
});
5757

@@ -82,7 +82,7 @@ describe('secrets', () => {
8282
name: 'secret_name',
8383
value: 'value'
8484
};
85-
const secretResponse = secrets.update({ api, ...secret });
85+
const secretResponse = secrets.update({ api, ...secret, sandbox: true });
8686
await expect(secretResponse).to.be.rejectedWith('Keys may include only uppercase letters, digits, and underscores, and must not begin with a digit.');
8787
});
8888

@@ -94,7 +94,7 @@ describe('secrets', () => {
9494
nock(baseUrl)
9595
.intercept(`/secrets/${secret.name}`, 'PUT')
9696
.reply(400, { ok: false, error: 'Failed to create secret: Name already in use' });
97-
const secretResponse = secrets.update({ api, ...secret });
97+
const secretResponse = secrets.update({ api, ...secret, sandbox: true });
9898
await expect(secretResponse).to.be.rejectedWith('Failed to create secret: Name already in use');
9999
});
100100
});
@@ -109,7 +109,7 @@ describe('secrets', () => {
109109
.intercept(`/secrets/${secret.name}`, 'PUT')
110110
.reply(200, secretGenericResponse);
111111

112-
const secretResponse = await secrets.update({ api, ...secret });
112+
const secretResponse = await secrets.update({ api, ...secret, sandbox: true });
113113
expect(secretResponse).to.deep.equal(formattedGenericSecretGet);
114114
});
115115
it('updates an org secret', async () => {
@@ -129,7 +129,7 @@ describe('secrets', () => {
129129
nock(baseUrl)
130130
.intercept(`/secrets/${name}`, 'GET')
131131
.reply(200, secretGenericResponse);
132-
const secretResponse = await secrets.get({ api, name });
132+
const secretResponse = await secrets.get({ api, name, sandbox: true });
133133
expect(secretResponse).to.deep.equal(formattedGenericSecretGet);
134134
});
135135

@@ -149,7 +149,7 @@ describe('secrets', () => {
149149
nock(baseUrl)
150150
.intercept(`/secrets/${name}`, 'GET')
151151
.reply(404, { ok: false, error: 'not found' });
152-
const secretResponse = secrets.get({ api, name });
152+
const secretResponse = secrets.get({ api, name, sandbox: true });
153153
await expect(secretResponse).to.be.rejectedWith(errorMessage);
154154
});
155155

@@ -161,7 +161,7 @@ describe('secrets', () => {
161161
nock(baseUrl)
162162
.intercept(`/secrets/${name}`, 'DELETE')
163163
.reply(204);
164-
const secretResponse = await secrets.remove({ api, name });
164+
const secretResponse = await secrets.remove({ api, name, sandbox: true });
165165
expect(secretResponse).to.equal(true);
166166
});
167167

@@ -185,7 +185,7 @@ describe('secrets', () => {
185185
.intercept(`/secrets/${name}`, 'DELETE')
186186
.reply(400, errorMessage);
187187

188-
const secretResponse = secrets.remove({ api, name });
188+
const secretResponse = secrets.remove({ api, name, sandbox: true });
189189
await expect(secretResponse).to.be.rejectedWith(errorMessage.error);
190190
scope.done();
191191
});

0 commit comments

Comments
 (0)