text: import {
    findOrCreateTransaction,
    getTransactionsBySender,
  } from '../../src/operations/transactionOperations'
  
  const Sequelize = require('sequelize')
  
  const models = require('../../src/models')
  
  let Transaction = models.Transaction
  const Op = Sequelize.Op
  
  beforeEach(() => {
    Transaction = models.Transaction // resetting Lock for before each test
  })
  
  describe('lockOperations', () => {
    describe('findOrCreateTransaction', () => {
      it('should call findOrCreate on the transaction object', async () => {
        expect.assertions(5)
        const transactionHash =
          '0x7d6289db59c3434b6a034b4f211be52ca34f05e2aa856fc3e69b8af101355842'
        const sender = '0x0x77cc4f1fe4555f9b9e0d1e918cac211915b079e5'
        const recipient = '0xca750f9232c1c38e34d27e77534e1631526ec99e'
        Transaction.findOrCreate = jest.fn(query => {
          expect(query.where).toEqual({
            transactionHash,
          })
          expect(query.defaults.transactionHash).toEqual(transactionHash)
          expect(query.defaults.sender).toEqual(
            '0x0X77Cc4F1FE4555f9b9E0d1E918caC211915b079e5'
          )
          expect(query.defaults.recipient).toEqual(
            '0xCA750f9232C1c38e34D27e77534e1631526eC99e'
          )
        })
        await findOrCreateTransaction({
          transactionHash,
          sender,
          recipient,
        })
        expect(Transaction.findOrCreate).toHaveBeenCalled()
      })
    })
  
    describe('getTransactionsBySender', () => {
      it('should get the list of transactions by that sender after having checksummed the address', async () => {
        expect.assertions(2)
        const sender = '0x0x77cc4f1fe4555f9b9e0d1e918cac211915b079e5'
        Transaction.findAll = jest.fn(query => {
          expect(query.where.sender[Op.eq]).toEqual(
            '0x0X77Cc4F1FE4555f9b9E0d1E918caC211915b079e5'
          )
        })
        await getTransactionsBySender(sender)
        expect(Transaction.findAll).toHaveBeenCalled()
      })
    })
  })
  