Skip to content

Commit 84cc2f7

Browse files
committed
fix: smplifiy the unittest
1 parent 9c0153b commit 84cc2f7

File tree

1 file changed

+5
-27
lines changed

1 file changed

+5
-27
lines changed

test/signer.ts

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
SignerExceptionMessages,
3030
} from '../src/signer';
3131
import {encodeURI, formatAsUTCISO, qsStringify} from '../src/util';
32-
import {Storage, ExceptionMessages} from '../src/storage';
32+
import {ExceptionMessages} from '../src/storage';
3333
import {OutgoingHttpHeaders} from 'http';
3434

3535
interface SignedUrlArgs {
@@ -574,38 +574,16 @@ describe('signer', () => {
574574
});
575575

576576
it('should not throw with expiration of exactly 7 days', async () => {
577-
const file = new Storage({
578-
projectId: 'xxxx',
579-
credentials: {
580-
type: 'service_account',
581-
private_key: crypto.generateKeyPairSync('rsa', {
582-
modulusLength: 512,
583-
publicKeyEncoding: {
584-
type: 'spki',
585-
format: 'pem',
586-
},
587-
privateKeyEncoding: {
588-
type: 'pkcs8',
589-
format: 'pem',
590-
},
591-
}).privateKey,
592-
client_email: 'xxxx',
593-
client_id: 'xxx',
594-
},
595-
})
596-
.bucket(BUCKET_NAME)
597-
.file(FILE_NAME);
598577
const ACCESSIBLE_AT = NOW.valueOf();
599578
const SEVEN_DAYS_IN_SECONDS = 7 * 24 * 60 * 60;
600579
const SEVEN_DAYS_IN_MS = SEVEN_DAYS_IN_SECONDS * 1000;
601580
await assert.doesNotReject(
602581
async () => {
603-
await file.getSignedUrl({
604-
version: 'v4',
605-
action: 'read',
606-
accessibleAt: ACCESSIBLE_AT,
582+
await signer.getSignedUrl({
583+
method: 'GET',
607584
expires: ACCESSIBLE_AT + SEVEN_DAYS_IN_MS,
608-
virtualHostedStyle: true,
585+
accessibleAt: ACCESSIBLE_AT,
586+
version: 'v4',
609587
});
610588
},
611589
err => {

0 commit comments

Comments
 (0)