Skip to content

Commit

Permalink
await assert.rejects (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaozhenliu-gg5 authored Apr 3, 2020
1 parent add36fa commit a0f266c
Show file tree
Hide file tree
Showing 24 changed files with 321 additions and 321 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ describe('v1beta1.BigQueryStorageClient', () => {
};
const expectedError = new Error('expected');
client.innerApiCalls.createReadSession = stubSimpleCall(undefined, expectedError);
assert.rejects(async () => { await client.createReadSession(request); }, expectedError);
await assert.rejects(async () => { await client.createReadSession(request); }, expectedError);
assert((client.innerApiCalls.createReadSession as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand Down Expand Up @@ -306,7 +306,7 @@ describe('v1beta1.BigQueryStorageClient', () => {
};
const expectedError = new Error('expected');
client.innerApiCalls.batchCreateReadSessionStreams = stubSimpleCall(undefined, expectedError);
assert.rejects(async () => { await client.batchCreateReadSessionStreams(request); }, expectedError);
await assert.rejects(async () => { await client.batchCreateReadSessionStreams(request); }, expectedError);
assert((client.innerApiCalls.batchCreateReadSessionStreams as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand Down Expand Up @@ -393,7 +393,7 @@ describe('v1beta1.BigQueryStorageClient', () => {
};
const expectedError = new Error('expected');
client.innerApiCalls.finalizeStream = stubSimpleCall(undefined, expectedError);
assert.rejects(async () => { await client.finalizeStream(request); }, expectedError);
await assert.rejects(async () => { await client.finalizeStream(request); }, expectedError);
assert((client.innerApiCalls.finalizeStream as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand Down Expand Up @@ -480,7 +480,7 @@ describe('v1beta1.BigQueryStorageClient', () => {
};
const expectedError = new Error('expected');
client.innerApiCalls.splitReadStream = stubSimpleCall(undefined, expectedError);
assert.rejects(async () => { await client.splitReadStream(request); }, expectedError);
await assert.rejects(async () => { await client.splitReadStream(request); }, expectedError);
assert((client.innerApiCalls.splitReadStream as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand Down Expand Up @@ -551,7 +551,7 @@ describe('v1beta1.BigQueryStorageClient', () => {
reject(err);
});
});
assert.rejects(async () => { await promise; }, expectedError);
await assert.rejects(async () => { await promise; }, expectedError);
assert((client.innerApiCalls.readRows as SinonStub)
.getCall(0).calledWith(request, expectedOptions));
});
Expand Down
20 changes: 10 additions & 10 deletions baselines/disable-packing-test/test/gapic_echo_v1beta1.ts.baseline
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ describe('v1beta1.EchoClient', () => {
const expectedOptions = {};
const expectedError = new Error('expected');
client.innerApiCalls.echo = stubSimpleCall(undefined, expectedError);
assert.rejects(async () => { await client.echo(request); }, expectedError);
await assert.rejects(async () => { await client.echo(request); }, expectedError);
assert((client.innerApiCalls.echo as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand Down Expand Up @@ -328,7 +328,7 @@ describe('v1beta1.EchoClient', () => {
const expectedOptions = {};
const expectedError = new Error('expected');
client.innerApiCalls.block = stubSimpleCall(undefined, expectedError);
assert.rejects(async () => { await client.block(request); }, expectedError);
await assert.rejects(async () => { await client.block(request); }, expectedError);
assert((client.innerApiCalls.block as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand Down Expand Up @@ -392,7 +392,7 @@ describe('v1beta1.EchoClient', () => {
const expectedOptions = {};
const expectedError = new Error('expected');
client.innerApiCalls.wait = stubLongRunningCall(undefined, expectedError);
assert.rejects(async () => { await client.wait(request); }, expectedError);
await assert.rejects(async () => { await client.wait(request); }, expectedError);
assert((client.innerApiCalls.wait as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand All @@ -408,7 +408,7 @@ describe('v1beta1.EchoClient', () => {
const expectedError = new Error('expected');
client.innerApiCalls.wait = stubLongRunningCall(undefined, undefined, expectedError);
const [operation] = await client.wait(request);
assert.rejects(async () => { await operation.promise(); }, expectedError);
await assert.rejects(async () => { await operation.promise(); }, expectedError);
assert((client.innerApiCalls.wait as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand Down Expand Up @@ -459,7 +459,7 @@ describe('v1beta1.EchoClient', () => {
reject(err);
});
});
assert.rejects(async () => { await promise; }, expectedError);
await assert.rejects(async () => { await promise; }, expectedError);
assert((client.innerApiCalls.expand as SinonStub)
.getCall(0).calledWith(request, expectedOptions));
});
Expand Down Expand Up @@ -513,7 +513,7 @@ describe('v1beta1.EchoClient', () => {
stream.write(request);
stream.end();
});
assert.rejects(async () => { await promise; }, expectedError);
await assert.rejects(async () => { await promise; }, expectedError);
assert((client.innerApiCalls.chat as SinonStub)
.getCall(0).calledWithExactly(undefined));
assert.deepStrictEqual(((stream as unknown as PassThrough)
Expand Down Expand Up @@ -573,7 +573,7 @@ describe('v1beta1.EchoClient', () => {
stream.write(request);
stream.end();
});
assert.rejects(async () => { await promise; }, expectedError);
await assert.rejects(async () => { await promise; }, expectedError);
assert((client.innerApiCalls.collect as SinonStub)
.getCall(0).calledWith(null, {} /*, callback defined above */));
});
Expand Down Expand Up @@ -641,7 +641,7 @@ describe('v1beta1.EchoClient', () => {
const expectedOptions = {};
const expectedError = new Error('expected');
client.innerApiCalls.pagedExpand = stubSimpleCall(undefined, expectedError);
assert.rejects(async () => { await client.pagedExpand(request); }, expectedError);
await assert.rejects(async () => { await client.pagedExpand(request); }, expectedError);
assert((client.innerApiCalls.pagedExpand as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand Down Expand Up @@ -700,7 +700,7 @@ describe('v1beta1.EchoClient', () => {
reject(err);
});
});
assert.rejects(async () => { await promise; }, expectedError);
await assert.rejects(async () => { await promise; }, expectedError);
assert((client.descriptors.page.pagedExpand.createStream as SinonStub)
.getCall(0).calledWith(client.innerApiCalls.pagedExpand, request));
});
Expand Down Expand Up @@ -737,7 +737,7 @@ describe('v1beta1.EchoClient', () => {
const request = generateSampleMessage(new protos.google.showcase.v1beta1.PagedExpandRequest());const expectedError = new Error('expected');
client.descriptors.page.pagedExpand.asyncIterate = stubAsyncIterationCall(undefined, expectedError);
const iterable = client.pagedExpandAsync(request);
assert.rejects(async () => {
await assert.rejects(async () => {
const responses: protos.google.showcase.v1beta1.IEchoResponse[] = [];
for await (const resource of iterable) {
responses.push(resource!);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ describe('v1beta1.IdentityClient', () => {
const expectedOptions = {};
const expectedError = new Error('expected');
client.innerApiCalls.createUser = stubSimpleCall(undefined, expectedError);
assert.rejects(async () => { await client.createUser(request); }, expectedError);
await assert.rejects(async () => { await client.createUser(request); }, expectedError);
assert((client.innerApiCalls.createUser as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand Down Expand Up @@ -303,7 +303,7 @@ describe('v1beta1.IdentityClient', () => {
};
const expectedError = new Error('expected');
client.innerApiCalls.getUser = stubSimpleCall(undefined, expectedError);
assert.rejects(async () => { await client.getUser(request); }, expectedError);
await assert.rejects(async () => { await client.getUser(request); }, expectedError);
assert((client.innerApiCalls.getUser as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand Down Expand Up @@ -390,7 +390,7 @@ describe('v1beta1.IdentityClient', () => {
};
const expectedError = new Error('expected');
client.innerApiCalls.updateUser = stubSimpleCall(undefined, expectedError);
assert.rejects(async () => { await client.updateUser(request); }, expectedError);
await assert.rejects(async () => { await client.updateUser(request); }, expectedError);
assert((client.innerApiCalls.updateUser as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand Down Expand Up @@ -474,7 +474,7 @@ describe('v1beta1.IdentityClient', () => {
};
const expectedError = new Error('expected');
client.innerApiCalls.deleteUser = stubSimpleCall(undefined, expectedError);
assert.rejects(async () => { await client.deleteUser(request); }, expectedError);
await assert.rejects(async () => { await client.deleteUser(request); }, expectedError);
assert((client.innerApiCalls.deleteUser as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand Down Expand Up @@ -542,7 +542,7 @@ describe('v1beta1.IdentityClient', () => {
const expectedOptions = {};
const expectedError = new Error('expected');
client.innerApiCalls.listUsers = stubSimpleCall(undefined, expectedError);
assert.rejects(async () => { await client.listUsers(request); }, expectedError);
await assert.rejects(async () => { await client.listUsers(request); }, expectedError);
assert((client.innerApiCalls.listUsers as SinonStub)
.getCall(0).calledWith(request, expectedOptions, undefined));
});
Expand Down Expand Up @@ -601,7 +601,7 @@ describe('v1beta1.IdentityClient', () => {
reject(err);
});
});
assert.rejects(async () => { await promise; }, expectedError);
await assert.rejects(async () => { await promise; }, expectedError);
assert((client.descriptors.page.listUsers.createStream as SinonStub)
.getCall(0).calledWith(client.innerApiCalls.listUsers, request));
});
Expand Down Expand Up @@ -638,7 +638,7 @@ describe('v1beta1.IdentityClient', () => {
const request = generateSampleMessage(new protos.google.showcase.v1beta1.ListUsersRequest());const expectedError = new Error('expected');
client.descriptors.page.listUsers.asyncIterate = stubAsyncIterationCall(undefined, expectedError);
const iterable = client.listUsersAsync(request);
assert.rejects(async () => {
await assert.rejects(async () => {
const responses: protos.google.showcase.v1beta1.IUser[] = [];
for await (const resource of iterable) {
responses.push(resource!);
Expand Down
Loading

0 comments on commit a0f266c

Please sign in to comment.