"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const sinon_1 = __importDefault(require("sinon"));
const Claims_1 = require("../Claims");
const queries_1 = require("../middleware/queries");
const types_1 = require("../middleware/types");
const mocks_1 = require("../testUtils/mocks");
const types_2 = require("../types");
const internal_1 = require("../types/internal");
const utilsConversionModule = __importStar(require("../utils/conversion"));
const internal_2 = require("../utils/internal");
jest.mock('~/api/entities/Identity', require("../testUtils/mocks/entities").mockIdentityModule('~/api/entities/Identity'));
jest.mock('~/base/Procedure', require("../testUtils/mocks/procedure").mockProcedureModule('~/base/Procedure'));
describe('Claims Class', () => {
    let context;
    let claims;
    beforeAll(() => {
        mocks_1.dsMockUtils.initMocks();
        mocks_1.entityMockUtils.initMocks();
        mocks_1.procedureMockUtils.initMocks();
    });
    beforeEach(() => {
        context = mocks_1.dsMockUtils.getContextInstance();
        claims = new Claims_1.Claims(context);
    });
    afterEach(() => {
        mocks_1.dsMockUtils.reset();
        mocks_1.entityMockUtils.reset();
        mocks_1.procedureMockUtils.reset();
    });
    afterAll(() => {
        mocks_1.dsMockUtils.cleanup();
        mocks_1.entityMockUtils.cleanup();
        mocks_1.procedureMockUtils.cleanup();
    });
    describe('method: getIssuedClaims', () => {
        test('should return a list of issued claims', () => __awaiter(void 0, void 0, void 0, function* () {
            const target = 'someDid';
            const getIdentityClaimsFromMiddleware = {
                data: [
                    {
                        target: mocks_1.entityMockUtils.getIdentityInstance({ did: target }),
                        issuer: mocks_1.entityMockUtils.getIdentityInstance({ did: 'otherDid' }),
                        issuedAt: new Date(),
                        expiry: null,
                        claim: { type: types_2.ClaimType.NoData },
                    },
                ],
                next: 1,
                count: 1,
            };
            mocks_1.dsMockUtils.configureMocks({
                contextOptions: {
                    getIdentityClaimsFromMiddleware,
                },
            });
            let result = yield claims.getIssuedClaims();
            expect(result).toEqual(getIdentityClaimsFromMiddleware);
            result = yield claims.getIssuedClaims({ target });
            expect(result).toEqual(getIdentityClaimsFromMiddleware);
        }));
    });
    describe('method: getIdentitiesWithClaims', () => {
        test('should return a list of Identities with claims associated to them', () => __awaiter(void 0, void 0, void 0, function* () {
            const targetDid = 'someTargetDid';
            const issuerDid = 'someIssuerDid';
            const date = 1589816265000;
            const customerDueDiligenceType = types_1.ClaimTypeEnum.CustomerDueDiligence;
            const cddId = 'someCddId';
            const claimData = {
                type: types_1.ClaimTypeEnum.CustomerDueDiligence,
                id: cddId,
            };
            const claim = {
                target: mocks_1.entityMockUtils.getIdentityInstance({ did: targetDid }),
                issuer: mocks_1.entityMockUtils.getIdentityInstance({ did: issuerDid }),
                issuedAt: new Date(date),
            };
            const fakeClaims = [
                {
                    identity: mocks_1.entityMockUtils.getIdentityInstance({ did: targetDid }),
                    claims: [
                        Object.assign(Object.assign({}, claim), { expiry: new Date(date), claim: claimData }),
                        Object.assign(Object.assign({}, claim), { expiry: null, claim: claimData }),
                    ],
                },
            ];
            /* eslint-disable @typescript-eslint/naming-convention */
            const commonClaimData = {
                targetDID: targetDid,
                issuer: issuerDid,
                issuance_date: date,
                last_update_date: date,
            };
            const didsWithClaimsQueryResponse = {
                totalCount: 25,
                items: [
                    {
                        did: targetDid,
                        claims: [
                            Object.assign(Object.assign({}, commonClaimData), { expiry: date, type: customerDueDiligenceType, cdd_id: cddId }),
                            Object.assign(Object.assign({}, commonClaimData), { expiry: null, type: customerDueDiligenceType, cdd_id: cddId }),
                        ],
                    },
                ],
            };
            /* eslint-enable @typescript-eslint/naming-convention */
            mocks_1.dsMockUtils.configureMocks({ contextOptions: { withSeed: true } });
            mocks_1.dsMockUtils.createApolloQueryStub(queries_1.didsWithClaims({
                dids: [targetDid],
                scope: undefined,
                trustedClaimIssuers: [targetDid],
                claimTypes: [types_1.ClaimTypeEnum.Accredited],
                includeExpired: false,
                count: 1,
                skip: undefined,
            }), {
                didsWithClaims: didsWithClaimsQueryResponse,
            });
            let result = yield claims.getIdentitiesWithClaims({
                targets: [targetDid],
                trustedClaimIssuers: [targetDid],
                claimTypes: [types_2.ClaimType.Accredited],
                includeExpired: false,
                size: 1,
            });
            expect(JSON.stringify(result.data)).toBe(JSON.stringify(fakeClaims));
            expect(result.count).toEqual(25);
            expect(result.next).toEqual(1);
            mocks_1.dsMockUtils.createApolloQueryStub(queries_1.didsWithClaims({
                dids: undefined,
                scope: undefined,
                trustedClaimIssuers: undefined,
                claimTypes: undefined,
                includeExpired: true,
                count: undefined,
                skip: undefined,
            }), {
                didsWithClaims: didsWithClaimsQueryResponse,
            });
            result = yield claims.getIdentitiesWithClaims();
            expect(JSON.stringify(result.data)).toBe(JSON.stringify(fakeClaims));
            expect(result.count).toEqual(25);
            expect(result.next).toEqual(null);
        }));
        test('should return a list of Identities with claims associated to them filtered by scope', () => __awaiter(void 0, void 0, void 0, function* () {
            const targetDid = 'someTargetDid';
            const issuerDid = 'someIssuerDid';
            const scope = { type: types_2.ScopeType.Ticker, value: 'someValue' };
            const date = 1589816265000;
            const accreditedType = types_1.ClaimTypeEnum.Accredited;
            const claim = {
                target: mocks_1.entityMockUtils.getIdentityInstance({ did: targetDid }),
                issuer: mocks_1.entityMockUtils.getIdentityInstance({ did: issuerDid }),
                issuedAt: new Date(date),
            };
            const fakeClaims = [
                {
                    identity: mocks_1.entityMockUtils.getIdentityInstance({ did: targetDid }),
                    claims: [
                        Object.assign(Object.assign({}, claim), { expiry: new Date(date), claim: {
                                type: accreditedType,
                                scope,
                            } }),
                        Object.assign(Object.assign({}, claim), { expiry: null, claim: {
                                type: accreditedType,
                                scope,
                            } }),
                    ],
                },
            ];
            /* eslint-disable @typescript-eslint/naming-convention */
            const commonClaimData = {
                targetDID: targetDid,
                issuer: issuerDid,
                issuance_date: date,
                last_update_date: date,
            };
            /* eslint-enable @typescript-eslint/naming-convention */
            const didsWithClaimsQueryResponse = {
                totalCount: 25,
                items: [
                    {
                        did: targetDid,
                        claims: [
                            Object.assign(Object.assign({}, commonClaimData), { expiry: date, type: accreditedType, scope: {
                                    type: types_1.ClaimScopeTypeEnum[scope.type],
                                    value: internal_2.padString(scope.value, 12),
                                } }),
                            Object.assign(Object.assign({}, commonClaimData), { expiry: null, type: accreditedType, scope: {
                                    type: types_1.ClaimScopeTypeEnum[scope.type],
                                    value: internal_2.padString(scope.value, 12),
                                } }),
                        ],
                    },
                ],
            };
            mocks_1.dsMockUtils.configureMocks({ contextOptions: { withSeed: true } });
            mocks_1.dsMockUtils.createApolloQueryStub(queries_1.didsWithClaims({
                dids: [targetDid],
                scope: { type: types_1.ClaimScopeTypeEnum[scope.type], value: internal_2.padString(scope.value, 12) },
                trustedClaimIssuers: [targetDid],
                claimTypes: [types_1.ClaimTypeEnum.Accredited],
                includeExpired: false,
                count: 1,
                skip: undefined,
            }), {
                didsWithClaims: didsWithClaimsQueryResponse,
            });
            const result = yield claims.getIdentitiesWithClaims({
                targets: [targetDid],
                trustedClaimIssuers: [targetDid],
                scope,
                claimTypes: [types_2.ClaimType.Accredited],
                includeExpired: false,
                size: 1,
            });
            expect(JSON.stringify(result.data)).toBe(JSON.stringify(fakeClaims));
            expect(result.count).toBe(25);
            expect(result.next).toBe(1);
        }));
    });
    describe('method: addClaims', () => {
        afterAll(() => {
            sinon_1.default.restore();
        });
        test('should prepare the procedure with the correct arguments and context, and return the resulting transaction queue', () => __awaiter(void 0, void 0, void 0, function* () {
            const targets = [
                {
                    target: 'someDid',
                    claim: {
                        type: types_2.ClaimType.Accredited,
                        scope: { type: types_2.ScopeType.Identity, value: 'someDid' },
                    },
                },
            ];
            const args = { claims: targets };
            const expectedQueue = 'someQueue';
            mocks_1.procedureMockUtils
                .getPrepareStub()
                .withArgs({ args: Object.assign(Object.assign({}, args), { operation: internal_1.ClaimOperation.Add }), transformer: undefined }, context)
                .resolves(expectedQueue);
            const queue = yield claims.addClaims(args);
            expect(queue).toBe(expectedQueue);
        }));
    });
    describe('method: addInvestorUniquenessClaim', () => {
        afterAll(() => {
            sinon_1.default.restore();
        });
        test('should prepare the procedure with the correct arguments and context, and return the resulting transaction queue', () => __awaiter(void 0, void 0, void 0, function* () {
            const ticker = 'SOME_TOKEN';
            const cddId = 'someId';
            const proof = 'someProof';
            const scopeId = 'someScopeId';
            const expiry = new Date();
            const args = {
                scope: { type: types_2.ScopeType.Ticker, value: ticker },
                cddId,
                proof,
                scopeId,
                expiry,
            };
            const expectedQueue = 'someQueue';
            mocks_1.procedureMockUtils
                .getPrepareStub()
                .withArgs({ args, transformer: undefined }, context)
                .resolves(expectedQueue);
            const queue = yield claims.addInvestorUniquenessClaim(args);
            expect(queue).toBe(expectedQueue);
        }));
    });
    describe('method: editClaims', () => {
        afterAll(() => {
            sinon_1.default.restore();
        });
        test('should prepare the procedure with the correct arguments and context, and return the resulting transaction queue', () => __awaiter(void 0, void 0, void 0, function* () {
            const targets = [
                {
                    target: 'someDid',
                    claim: {
                        type: types_2.ClaimType.Accredited,
                        scope: { type: types_2.ScopeType.Identity, value: 'someDid' },
                    },
                },
            ];
            const args = { claims: targets };
            const expectedQueue = 'someQueue';
            mocks_1.procedureMockUtils
                .getPrepareStub()
                .withArgs({ args: Object.assign(Object.assign({}, args), { operation: internal_1.ClaimOperation.Edit }), transformer: undefined }, context)
                .resolves(expectedQueue);
            const queue = yield claims.editClaims(args);
            expect(queue).toBe(expectedQueue);
        }));
    });
    describe('method: revokeClaims', () => {
        afterAll(() => {
            sinon_1.default.restore();
        });
        test('should prepare the procedure with the correct arguments and context, and return the resulting transaction queue', () => __awaiter(void 0, void 0, void 0, function* () {
            const targets = [
                {
                    target: 'someDid',
                    claim: {
                        type: types_2.ClaimType.Accredited,
                        scope: { type: types_2.ScopeType.Identity, value: 'someDid' },
                    },
                },
            ];
            const args = { claims: targets };
            const expectedQueue = 'someQueue';
            mocks_1.procedureMockUtils
                .getPrepareStub()
                .withArgs({ args: Object.assign(Object.assign({}, args), { operation: internal_1.ClaimOperation.Revoke }), transformer: undefined }, context)
                .resolves(expectedQueue);
            const queue = yield claims.revokeClaims(args);
            expect(queue).toBe(expectedQueue);
        }));
    });
    describe('method: getCddClaims', () => {
        test('should return a list of cdd claims', () => __awaiter(void 0, void 0, void 0, function* () {
            const target = 'someTarget';
            const identityClaims = [
                {
                    target: mocks_1.entityMockUtils.getIdentityInstance({ did: target }),
                    issuer: mocks_1.entityMockUtils.getIdentityInstance({ did: 'otherDid' }),
                    issuedAt: new Date(),
                    expiry: null,
                    claim: {
                        type: types_2.ClaimType.CustomerDueDiligence,
                        id: 'someId',
                    },
                },
            ];
            mocks_1.dsMockUtils.configureMocks({
                contextOptions: {
                    getIdentityClaimsFromChain: identityClaims,
                },
            });
            let result = yield claims.getCddClaims({ target });
            expect(result).toEqual(identityClaims);
            result = yield claims.getCddClaims();
            expect(result).toEqual(identityClaims);
        }));
    });
    describe('method: getClaimScopes', () => {
        test('should return a list of scopes and tickers', () => __awaiter(void 0, void 0, void 0, function* () {
            const target = 'someTarget';
            const ticker = 'FAKETICKER';
            const someDid = 'someDid';
            const fakeClaimData = [
                {
                    claim: {
                        type: types_2.ClaimType.InvestorUniqueness,
                        scope: {
                            type: types_2.ScopeType.Ticker,
                            value: ticker,
                        },
                    },
                },
                {
                    claim: {
                        type: types_2.ClaimType.Jurisdiction,
                        scope: {
                            type: types_2.ScopeType.Identity,
                            value: someDid,
                        },
                    },
                },
                {
                    claim: {
                        type: types_2.ClaimType.Jurisdiction,
                        scope: {
                            type: types_2.ScopeType.Identity,
                            value: someDid,
                        },
                    },
                },
            ];
            mocks_1.dsMockUtils.configureMocks({
                contextOptions: {
                    did: target,
                    getIdentityClaimsFromChain: fakeClaimData,
                },
            });
            let result = yield claims.getClaimScopes({ target });
            expect(result[0].ticker).toBe(ticker);
            expect(result[0].scope).toEqual({ type: types_2.ScopeType.Ticker, value: ticker });
            expect(result[1].ticker).toBeUndefined();
            expect(result[1].scope).toEqual({ type: types_2.ScopeType.Identity, value: someDid });
            result = yield claims.getClaimScopes();
            expect(result.length).toEqual(2);
        }));
    });
    describe('method: getTargetingClaims', () => {
        afterAll(() => {
            sinon_1.default.restore();
        });
        test('should return a list of claims issued with an Identity as target', () => __awaiter(void 0, void 0, void 0, function* () {
            const did = 'someDid';
            const issuerDid = 'someIssuerDid';
            const date = 1589816265000;
            const claim = {
                target: mocks_1.entityMockUtils.getIdentityInstance({ did }),
                issuer: mocks_1.entityMockUtils.getIdentityInstance({ did: issuerDid }),
                issuedAt: new Date(date),
            };
            const fakeClaims = [
                {
                    identity: mocks_1.entityMockUtils.getIdentityInstance({ did }),
                    claims: [
                        Object.assign(Object.assign({}, claim), { expiry: new Date(date), claim: {
                                type: types_2.ClaimType.CustomerDueDiligence,
                                id: 'someCddId',
                            } }),
                    ],
                },
            ];
            /* eslint-disable @typescript-eslint/naming-convention */
            const commonClaimData = {
                targetDID: did,
                issuer: issuerDid,
                issuance_date: date,
                last_update_date: date,
            };
            /* eslint-enable @typescript-eslint/naming-convention */
            const issuerDidsWithClaimsByTargetQueryResponse = {
                totalCount: 25,
                items: [
                    {
                        did,
                        claims: [
                            Object.assign(Object.assign({}, commonClaimData), { expiry: date, type: types_1.ClaimTypeEnum.CustomerDueDiligence }),
                        ],
                    },
                ],
            };
            mocks_1.dsMockUtils.configureMocks({ contextOptions: { withSeed: true } });
            sinon_1.default
                .stub(utilsConversionModule, 'toIdentityWithClaimsArray')
                .withArgs(issuerDidsWithClaimsByTargetQueryResponse.items, context)
                .returns(fakeClaims);
            mocks_1.dsMockUtils.createApolloQueryStub(queries_1.issuerDidsWithClaimsByTarget({
                target: did,
                scope: undefined,
                trustedClaimIssuers: [did],
                includeExpired: false,
                count: 1,
                skip: undefined,
            }), {
                issuerDidsWithClaimsByTarget: issuerDidsWithClaimsByTargetQueryResponse,
            });
            let result = yield claims.getTargetingClaims({
                target: did,
                trustedClaimIssuers: [did],
                includeExpired: false,
                size: 1,
            });
            expect(result.data).toEqual(fakeClaims);
            expect(result.count).toEqual(25);
            expect(result.next).toEqual(1);
            mocks_1.dsMockUtils.createApolloQueryStub(queries_1.issuerDidsWithClaimsByTarget({
                target: did,
                scope: undefined,
                trustedClaimIssuers: undefined,
                includeExpired: true,
                count: undefined,
                skip: undefined,
            }), {
                issuerDidsWithClaimsByTarget: issuerDidsWithClaimsByTargetQueryResponse,
            });
            result = yield claims.getTargetingClaims();
            expect(result.data).toEqual(fakeClaims);
            expect(result.count).toEqual(25);
            expect(result.next).toBeNull();
        }));
        test('should return a list of claims issued with an Identity as target from chain', () => __awaiter(void 0, void 0, void 0, function* () {
            const target = 'someTarget';
            const issuer = 'someIssuer';
            const otherIssuer = 'otherIssuer';
            const scope = {
                type: types_2.ScopeType.Identity,
                value: 'someIdentityScope',
            };
            const identityClaims = [
                {
                    target: mocks_1.entityMockUtils.getIdentityInstance({ did: target }),
                    issuer: mocks_1.entityMockUtils.getIdentityInstance({ did: issuer }),
                    issuedAt: new Date(),
                    expiry: null,
                    claim: {
                        type: types_2.ClaimType.Accredited,
                        scope,
                    },
                },
                {
                    target: mocks_1.entityMockUtils.getIdentityInstance({ did: target }),
                    issuer: mocks_1.entityMockUtils.getIdentityInstance({ did: issuer }),
                    issuedAt: new Date(),
                    expiry: null,
                    claim: {
                        type: types_2.ClaimType.InvestorUniqueness,
                        scope,
                        cddId: 'someCddId',
                        scopeId: 'someScopeId',
                    },
                },
                {
                    target: mocks_1.entityMockUtils.getIdentityInstance({ did: target }),
                    issuer: mocks_1.entityMockUtils.getIdentityInstance({ did: otherIssuer }),
                    issuedAt: new Date(),
                    expiry: null,
                    claim: {
                        type: types_2.ClaimType.InvestorUniqueness,
                        scope,
                        cddId: 'otherCddId',
                        scopeId: 'someScopeId',
                    },
                },
            ];
            mocks_1.dsMockUtils.configureMocks({
                contextOptions: {
                    middlewareAvailable: false,
                    getIdentityClaimsFromChain: identityClaims,
                },
            });
            let result = yield claims.getTargetingClaims({
                target: target,
            });
            expect(result.data.length).toEqual(2);
            expect(result.data[0].identity.did).toEqual(issuer);
            expect(result.data[0].claims.length).toEqual(2);
            expect(result.data[0].claims[0].claim).toEqual(identityClaims[0].claim);
            expect(result.data[0].claims[1].claim).toEqual(identityClaims[1].claim);
            expect(result.data[1].identity.did).toEqual(otherIssuer);
            expect(result.data[1].claims.length).toEqual(1);
            expect(result.data[1].claims[0].claim).toEqual(identityClaims[2].claim);
            result = yield claims.getTargetingClaims({
                target: target,
                trustedClaimIssuers: ['trusted'],
            });
            expect(result.data.length).toEqual(2);
        }));
    });
    describe('method: getInvestorUniquenessClaims', () => {
        test('should return a list of claim data', () => __awaiter(void 0, void 0, void 0, function* () {
            const target = 'someTarget';
            const scope = {
                type: types_2.ScopeType.Identity,
                value: 'someIdentityScope',
            };
            const identityClaims = [
                {
                    target: mocks_1.entityMockUtils.getIdentityInstance({ did: target }),
                    issuer: mocks_1.entityMockUtils.getIdentityInstance({ did: 'otherDid' }),
                    issuedAt: new Date(),
                    expiry: null,
                    claim: {
                        type: types_2.ClaimType.InvestorUniqueness,
                        scope,
                        cddId: 'someCddId',
                        scopeId: 'someScopeId',
                    },
                },
            ];
            mocks_1.dsMockUtils.configureMocks({
                contextOptions: {
                    getIdentityClaimsFromChain: identityClaims,
                },
            });
            let result = yield claims.getInvestorUniquenessClaims({ target });
            expect(result).toEqual(identityClaims);
            result = yield claims.getInvestorUniquenessClaims();
            expect(result).toEqual(identityClaims);
        }));
    });
    test('should return a list of claims issued with an Identity as target and a given Scope', () => __awaiter(void 0, void 0, void 0, function* () {
        const did = 'someDid';
        const issuerDid = 'someIssuerDid';
        const scope = { type: types_2.ScopeType.Ticker, value: 'someValue' };
        const date = 1589816265000;
        const claim = {
            target: mocks_1.entityMockUtils.getIdentityInstance({ did }),
            issuer: mocks_1.entityMockUtils.getIdentityInstance({ did: issuerDid }),
            issuedAt: new Date(date),
        };
        const fakeClaims = [
            {
                identity: mocks_1.entityMockUtils.getIdentityInstance({ did }),
                claims: [
                    Object.assign(Object.assign({}, claim), { expiry: new Date(date), claim: {
                            type: types_2.ClaimType.Accredited,
                            scope,
                        } }),
                ],
            },
        ];
        /* eslint-disable @typescript-eslint/naming-convention */
        const commonClaimData = {
            targetDID: did,
            issuer: issuerDid,
            issuance_date: date,
            last_update_date: date,
        };
        /* eslint-enable @typescript-eslint/naming-convention */
        const issuerDidsWithClaimsByTargetQueryResponse = {
            totalCount: 25,
            items: [
                {
                    did,
                    claims: [
                        Object.assign(Object.assign({}, commonClaimData), { expiry: date, type: types_1.ClaimTypeEnum.Accredited, scope: { type: types_1.ClaimScopeTypeEnum[scope.type], value: internal_2.padString(scope.value, 12) } }),
                    ],
                },
            ],
        };
        mocks_1.dsMockUtils.configureMocks({ contextOptions: { withSeed: true } });
        sinon_1.default
            .stub(utilsConversionModule, 'toIdentityWithClaimsArray')
            .withArgs(issuerDidsWithClaimsByTargetQueryResponse.items, context)
            .returns(fakeClaims);
        mocks_1.dsMockUtils.createApolloQueryStub(queries_1.issuerDidsWithClaimsByTarget({
            target: did,
            scope: { type: types_1.ClaimScopeTypeEnum[scope.type], value: internal_2.padString(scope.value, 12) },
            trustedClaimIssuers: [did],
            includeExpired: false,
            count: 1,
            skip: undefined,
        }), {
            issuerDidsWithClaimsByTarget: issuerDidsWithClaimsByTargetQueryResponse,
        });
        const result = yield claims.getTargetingClaims({
            target: did,
            trustedClaimIssuers: [did],
            scope,
            includeExpired: false,
            size: 1,
        });
        expect(result.data).toEqual(fakeClaims);
        expect(result.count).toEqual(25);
        expect(result.next).toEqual(1);
    }));
});
//# sourceMappingURL=Claims.js.map