mirror of
				https://github.com/zulip/zulip.git
				synced 2025-10-31 03:53:50 +00:00 
			
		
		
		
	tests: Fully cover hash_util.js.
This commit is contained in:
		| @@ -2,6 +2,16 @@ zrequire('hash_util'); | ||||
| zrequire('stream_data'); | ||||
| zrequire('people'); | ||||
|  | ||||
| var _window = { | ||||
|     location: { | ||||
|         protocol: "https:", | ||||
|         host: "example.com", | ||||
|         pathname: "/", | ||||
|     }, | ||||
| }; | ||||
|  | ||||
| global.patch_builtin('window', _window); | ||||
|  | ||||
| var hamlet = { | ||||
|     user_id: 1, | ||||
|     email: 'hamlet@example.com', | ||||
| @@ -52,3 +62,26 @@ run_test('hash_util', () => { | ||||
|  | ||||
|     encode_decode_operand(operator, operand, 'testing.20123'); | ||||
| }); | ||||
|  | ||||
| run_test('test_by_conversation_and_time_uri', () => { | ||||
|     var message = { | ||||
|         type: 'stream', | ||||
|         stream: 'frontend', | ||||
|         subject: 'testing', | ||||
|         id: 42, | ||||
|     }; | ||||
|  | ||||
|     assert.equal(hash_util.by_conversation_and_time_uri(message), | ||||
|                  'https://example.com/#narrow/stream/99-frontend/subject/testing/near/42'); | ||||
|  | ||||
|     message = { | ||||
|         type: 'private', | ||||
|         reply_to: 'iago@example.com,hamlet@example.com', | ||||
|         id: 43, | ||||
|     }; | ||||
|  | ||||
|     people.my_current_email = () => 'jeff@example.com'; | ||||
|  | ||||
|     assert.equal(hash_util.by_conversation_and_time_uri(message), | ||||
|                  'https://example.com/#narrow/pm-with/iago.40example.2Ecom.2Chamlet.40example.2Ecom.2Cjeff.40example.2Ecom/near/43'); | ||||
| }); | ||||
|   | ||||
| @@ -43,6 +43,7 @@ enforce_fully_covered = { | ||||
|     'static/js/fenced_code.js', | ||||
|     'static/js/fetch_status.js', | ||||
|     'static/js/filter.js', | ||||
|     'static/js/hash_util.js', | ||||
|     'static/js/keydown_util.js', | ||||
|     'static/js/markdown.js', | ||||
|     'static/js/message_store.js', | ||||
|   | ||||
		Reference in New Issue
	
	Block a user