mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 12:03:46 +00:00 
			
		
		
		
	js: Convert people module to ES6.
This commit is contained in:
		
				
					committed by
					
						 Anders Kaseorg
						Anders Kaseorg
					
				
			
			
				
	
			
			
			
						parent
						
							aca77e9245
						
					
				
				
					commit
					551a19c90d
				
			| @@ -783,13 +783,12 @@ run_test("initialize", () => { | ||||
|         assert.equal(appended_name, "Othello, the Moor of Venice"); | ||||
|  | ||||
|         let appended_names = []; | ||||
|         people.get_by_user_id = function (user_id) { | ||||
|         people.__Rewire__("get_by_user_id", (user_id) => { | ||||
|             const users = {100: hamlet, 104: lear}; | ||||
|             return users[user_id]; | ||||
|         }; | ||||
|         people.my_current_email = function () { | ||||
|             return "hamlet@zulip.com"; | ||||
|         }; | ||||
|         }); | ||||
|  | ||||
|         people.__Rewire__("my_current_email", () => "hamlet@zulip.com"); | ||||
|         compose_pm_pill.set_from_typeahead = function (item) { | ||||
|             appended_names.push(item.full_name); | ||||
|         }; | ||||
|   | ||||
| @@ -737,20 +737,20 @@ run_test("extract_people_from_message", () => { | ||||
|     assert(!people.is_known_user_id(maria.user_id)); | ||||
|  | ||||
|     let reported; | ||||
|     people.report_late_add = function (user_id, email) { | ||||
|     people.__Rewire__("report_late_add", (user_id, email) => { | ||||
|         assert.equal(user_id, maria.user_id); | ||||
|         assert.equal(email, maria.email); | ||||
|         reported = true; | ||||
|     }; | ||||
|     }); | ||||
|  | ||||
|     people.extract_people_from_message(message); | ||||
|     assert(people.is_known_user_id(maria.user_id)); | ||||
|     assert(reported); | ||||
|  | ||||
|     // Get line coverage | ||||
|     people.report_late_add = function () { | ||||
|     people.__Rewire__("report_late_add", () => { | ||||
|         throw Error("unexpected late add"); | ||||
|     }; | ||||
|     }); | ||||
|  | ||||
|     message = { | ||||
|         type: "private", | ||||
|   | ||||
| @@ -104,12 +104,8 @@ run_test("blueslip", () => { | ||||
|     const reply_to = people.pm_reply_to(message); | ||||
|     assert(reply_to.includes("?")); | ||||
|  | ||||
|     people.pm_with_user_ids = function () { | ||||
|         return [42]; | ||||
|     }; | ||||
|     people.get_by_user_id = function () { | ||||
|         return; | ||||
|     }; | ||||
|     people.__Rewire__("pm_with_user_ids", () => [42]); | ||||
|     people.__Rewire__("get_by_user_id", () => {}); | ||||
|     blueslip.expect("error", "Unknown people in message"); | ||||
|     const uri = people.pm_with_url({}); | ||||
|     assert.equal(uri.indexOf("unk"), uri.length - 3); | ||||
|   | ||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
		Reference in New Issue
	
	Block a user