Skip to content

Commit 70b04d7

Browse files
committed
fix limits tests v2
1 parent a970519 commit 70b04d7

4 files changed

Lines changed: 13 additions & 25 deletions

File tree

lib/IAMClient.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -367,7 +367,7 @@ class VaultClient {
367367
};
368368

369369
assert(!this.parameterValidation || typeof accountName === 'string',
370-
'the account name, should be a string');
370+
'the account name should be a string');
371371
data.AccountName = accountName;
372372
this.request('POST', '/', true, callback, data);
373373
}

tests/unit/deleteAccountLimits.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,25 +31,19 @@ describe('IAMClient - deleteAccountLimits', () => {
3131
});
3232
});
3333

34-
it('should call the request method with the correct parameters when accountName is not provided', () => {
34+
it('should throw an error when accountName is not provided', () => {
3535
client = createClient(true);
36-
client.deleteAccountLimits(undefined, () => {});
37-
38-
assert.strictEqual(lastRequestData.method, 'POST');
39-
assert.strictEqual(lastRequestData.path, '/');
40-
assert.strictEqual(lastRequestData.iamAuthenticate, true);
41-
assert.deepStrictEqual(lastRequestData.data, {
42-
Action: 'DeleteAccountLimits',
43-
Version: '2010-05-08',
44-
});
36+
assert.throws(() => {
37+
client.deleteAccountLimits(undefined, () => {});
38+
}, /the account name should be a string/);
4539
});
4640

4741
it('should throw an error if accountName is not a string', () => {
4842
client = createClient(true);
4943
const accountName = 123;
5044
assert.throws(() => {
5145
client.deleteAccountLimits(accountName, () => {});
52-
}, /the account name, if set, should be a string/);
46+
}, /the account name should be a string/);
5347
});
5448

5549
it('should call the request method when wrong options are provided and parameterValidation is false', () => {

tests/unit/getAccountLimits.js

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,12 @@ describe('GetAccountLimits', () => {
3232
assert.deepStrictEqual(lastRequestData.data, expectedData);
3333
});
3434

35-
it('should call the request method with default parameters when accountName is not provided', () => {
35+
it('should throw an error when accountName is not provided', () => {
3636
client = createClient(true);
3737
const callback = () => {};
38-
client.getAccountLimits(undefined, callback);
39-
const expectedData = {
40-
Action: 'GetAccountLimits',
41-
Version: '2010-05-08',
42-
};
43-
assert.strictEqual(lastRequestData.method, 'POST');
44-
assert.strictEqual(lastRequestData.path, '/');
45-
assert.strictEqual(lastRequestData.iamAuthenticate, true);
46-
assert.deepStrictEqual(lastRequestData.data, expectedData);
38+
assert.throws(() => {
39+
client.getAccountLimits(undefined, callback);
40+
}, /the account name should be a string/);
4741
});
4842

4943
it('should throw an error if accountName is not a string', () => {
@@ -52,7 +46,7 @@ describe('GetAccountLimits', () => {
5246
const callback = () => {};
5347
assert.throws(() => {
5448
client.getAccountLimits(accountName, callback);
55-
}, /the account name, if set, should be a string/);
49+
}, /the account name should be a string/);
5650
});
5751

5852
it('should not throw an error if accountName is not a string and parameterValidation is false', () => {

tests/unit/getAccountLimitsByCanonicalId.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ describe('getAccountLimitsByCanonicalIds', () => {
2727
afterEach('reset spyArg', () => { spyArg = null; });
2828

2929
it('should send request with correct arguments', () => {
30-
client.getAccountLimitsByCanonicalIds(canonicalIds, { reqUid});
30+
client.getAccountLimitsByCanonicalIds(canonicalIds, opt, mockCB);
3131
const [method, path, auth, cb, data, reqUid, contentType] = spyArg;
3232
assert.strictEqual(method, 'GET');
3333
assert.strictEqual(path, '/');
3434
assert.strictEqual(auth, false);
35-
assert.strictEqual(cb, mockCB);
35+
assert.strictEqual(typeof cb, 'function');
3636
assert.strictEqual(reqUid, opt.reqUid);
3737
assert.strictEqual(contentType, null);
3838
assert.deepStrictEqual(

0 commit comments

Comments
 (0)