Skip to content
This repository has been archived by the owner on May 29, 2024. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
m00sey committed Oct 3, 2023
1 parent c0fc9fd commit f63524e
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions test/operations.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { SignifyClient, Credentials, Operations } from 'signify-ts';
import { describe, expect, it } from '@jest/globals';
import { instance, mock, when } from 'ts-mockito';
import { operations } from '../src/operations';

describe('operations', () => {
// it('should complete', () => {
// let mockedClient: SignifyClient = mock(SignifyClient);

// let c: Credentials = mock(Credentials);
// when(mockedClient.credentials()).thenReturn(instance(c));

// let client = instance(mockedClient);

// let op = { done: true };

// operations.getResult(client, op);
// });

it('should retry', () => {
let mockedClient: SignifyClient = mock(SignifyClient);

let c: Credentials = mock(Credentials);
when(mockedClient.credentials()).thenReturn(instance(c));

let mockedOps: Operations = mock(Operations);
when(mockedOps.get('my_op')).thenResolve(undefined);
when(mockedClient.operations()).thenReturn(instance(mockedOps));

let client = instance(mockedClient);

let op = { done: false, name: 'my_op' };
let resp = operations.getResult({ client: client, op: op });
expect(resp).toEqual('yay');
});
});

0 comments on commit f63524e

Please sign in to comment.