UNPKG

@valora/secrets-loader

Version:

Library for loading secrets via Google Cloud's Secrets Manager

30 lines 987 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const index_1 = require("./index"); describe('loadSecret', () => { it('parses a secret', async () => { const fakeClient = { accessSecretVersion: async () => { return [{ payload: { data: 'SECRET1=foo\nSECRET2=bar' } }]; } }; const secret = await index_1.loadSecret('/foo', fakeClient); expect(secret.SECRET1).toEqual('foo'); expect(secret.SECRET2).toEqual('bar'); }); it('fails if missing secret', async () => { const fakeClient = { accessSecretVersion: async () => { return [{ payload: {} }]; } }; await expect(index_1.loadSecret('/foo', fakeClient)).rejects.toThrow(); }); }); //# sourceMappingURL=test.js.map