Skip to content
This repository was archived by the owner on Mar 3, 2026. It is now read-only.

Commit 3cb4780

Browse files
test: fix precondition test (#1481)
* test: fix precondition test This test matches the exact error string from the service, which has changed. Using the reason instead should be more robust. Same as googleapis/java-storage#861 Fixes #1480 * fix error structure * test: changed test to look for error code and reason: * linted files Co-authored-by: Sameena Shaffeeullah <shaffeeullah@google.com>
1 parent 1b763e4 commit 3cb4780

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

system-test/storage.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3378,14 +3378,11 @@ describe('storage', () => {
33783378
.file(fileName)
33793379
.save('hello1', {resumable: false});
33803380
await assert.rejects(
3381-
async () => {
3382-
await bucketWithVersioning
3383-
.file(fileName, {generation: 0})
3384-
.save('hello2');
3385-
},
3386-
{
3387-
code: 412,
3388-
message: 'Precondition Failed',
3381+
bucketWithVersioning.file(fileName, {generation: 0}).save('hello2'),
3382+
(err: ApiError) => {
3383+
assert.strictEqual(err.code, 412);
3384+
assert.strictEqual(err.errors![0].reason, 'conditionNotMet');
3385+
return true;
33893386
}
33903387
);
33913388
await bucketWithVersioning

0 commit comments

Comments
 (0)