def test_handle_decoded_payload_jid_match_in_jid_queue():
    """
    Tests that the _handle_decoded_payload function returns when a jid is given that is already present
    in the jid_queue.

    Note: This test doesn't contain all of the patch decorators above the function like the other tests
    for _handle_decoded_payload below. This is essential to this test as the call to the function must
    return None BEFORE any of the processes are spun up because we should be avoiding firing duplicate
    jobs.
    """
    mock_opts = salt.config.DEFAULT_MINION_OPTS.copy()
    mock_data = {"fun": "foo.bar", "jid": 123}
    mock_jid_queue = [123]
    minion = salt.minion.Minion(
        mock_opts,
        jid_queue=copy.copy(mock_jid_queue),
        io_loop=salt.ext.tornado.ioloop.IOLoop(),
    )
    try:
        ret = minion._handle_decoded_payload(mock_data).result()
        assert minion.jid_queue == mock_jid_queue
        assert ret is None
    finally:
        minion.destroy()