(config: SecretsDbStubConfig)
| 20 | } |
| 21 | |
| 22 | function createDbStub(config: SecretsDbStubConfig): NodePgDatabase<typeof schema> { |
| 23 | return { |
| 24 | select(selection: Record<string, unknown>) { |
| 25 | if ('name' in selection) { |
| 26 | return { |
| 27 | from() { |
| 28 | return { |
| 29 | orderBy() { |
| 30 | return Promise.resolve(config.list ?? []); |
| 31 | }, |
| 32 | }; |
| 33 | }, |
| 34 | }; |
| 35 | } |
| 36 | |
| 37 | return { |
| 38 | from() { |
| 39 | return { |
| 40 | where() { |
| 41 | return { |
| 42 | limit() { |
| 43 | return Promise.resolve(config.versions ?? []); |
| 44 | }, |
| 45 | }; |
| 46 | }, |
| 47 | }; |
| 48 | }, |
| 49 | }; |
| 50 | }, |
| 51 | } as unknown as NodePgDatabase<typeof schema>; |
| 52 | } |
| 53 | |
| 54 | describe('SecretsAdapter', () => { |
| 55 | let originalMasterKey: string | undefined; |
no outgoing calls
no test coverage detected