public class LeadReparentChatTranscript {

  public static void doUpdate(Map<Id,Id> convertedLeadsWithContactIds) {
		//convertedLeadsWithContactIds, key is the LeadId, value is the ConvertedContactId;
		//go through and get all the corresponding Transcript records
		List<LiveChatTranscript> tList = new List<LiveChatTranscript>();		
		tList = [SELECT Id, LeadId, ContactId FROM LiveChatTranscript WHERE LeadId IN: convertedLeadsWithContactIds.keySet() LIMIT 10000];
		if (!tList.isEmpty()) {			
			for(LiveChatTranscript l : tList) {
				l.ContactId = convertedLeadsWithContactIds.get(l.LeadId);				
			}			
			update tList;
		}	 
	}
	
	
	static testMethod void doTest() {		
		Map<Id,Id> convertedLeadsWithContactIds = new Map<Id,Id>();
		
		//create a contact
		Contact testContact = new Contact(LastName='Smith');
		insert testContact;
		update testContact;
		
		//create a lead
		Lead testLead = new Lead(LastName='Smith', Company='ACME');
		insert testLead;
		update testLead;
		
		//create a live chat visitor
		LiveChatVisitor testVisit = new LiveChatVisitor();
		insert testVisit;
		update testVisit;
		
		//create a transcript
		LiveChatTranscript testTrans = new LiveChatTranscript(LeadId=testLead.Id, LiveChatVisitorId=testVisit.Id);
		insert testTrans;
		update testTrans;
		
		convertedLeadsWithContactIds.put(testLead.Id, testContact.Id);

		LeadReparentChatTranscript.doUpdate(convertedLeadsWithContactIds);
	}	
	



}