How to use the fabric-contract-api/lib/jsontransactionserializer.prototype function in fabric-contract-api

To help you get started, we’ve selected a few fabric-contract-api examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github IBM-Blockchain / vehicle-manufacture / contract / src / serializer.spec.ts View on Github external
it ('should call serialize and then return the super to buffer', () => {
            const myBuffer = Buffer.from('some buffer');

            const toBufferStub = sandbox.stub(FabricJSONSerializer.prototype, 'toBuffer').returns(myBuffer);
            const serializeStub = sandbox.stub(serializer as any, 'serialize').returns('some serialized result');

            serializer.toBuffer('some original result', {}, 'some prefix').should.deep.equal(myBuffer);

            serializeStub.should.have.been.calledOnceWithExactly('some original result');
            toBufferStub.should.have.been.calledOnceWithExactly('some serialized result', {}, 'some prefix');
        });
github IBM-Blockchain / vehicle-manufacture / contract / src / serializer.spec.ts View on Github external
it ('should call seriakuze then return the super to buffer when schema null', () => {
            const myBuffer = Buffer.from('some buffer');

            const toBufferStub = sandbox.stub(FabricJSONSerializer.prototype, 'toBuffer').returns(myBuffer);
            const serializeStub = sandbox.stub(serializer as any, 'serialize').returns('some serialized result');

            serializer.toBuffer('some original result', undefined, 'some prefix').should.deep.equal(myBuffer);

            serializeStub.should.have.been.calledOnceWithExactly('some original result');
            toBufferStub.should.have.been.calledOnceWithExactly('some serialized result', {}, 'some prefix');
        });
    });