github.com/jfrog/jfrog-cli-platform-services@v1.2.0/commands/templates/GENERIC_EVENT.spec.ts_template (about) 1 import { PlatformContext, PlatformClients, PlatformHttpClient } from 'jfrog-workers'; 2 import { createMock, DeepMocked } from '@golevelup/ts-jest'; 3 import runWorker from './worker'; 4 5 describe("{{.WorkerName}} tests", () => { 6 let context: DeepMocked<PlatformContext>; 7 const request: void = undefined; 8 9 beforeEach(() => { 10 context = createMock<PlatformContext>({ 11 clients: createMock<PlatformClients>({ 12 platformHttp: createMock<PlatformHttpClient>({ 13 get: jest.fn().mockResolvedValue({ 14 status: 200, 15 data: [ 16 { type: 'a' }, 17 { type: 'a' }, 18 { type: 'b' }, 19 { type: 'c' } 20 ], 21 }) 22 }) 23 }) 24 }); 25 }) 26 27 it('should run', async () => { 28 await expect(runWorker(context, request)).resolves.toEqual(expect.objectContaining({ 29 repositories: expect.objectContaining({ 30 a: 2, b: 1, c: 1 31 }) 32 })) 33 }) 34 });