(t *testing.T)
| 2831 | } |
| 2832 | |
| 2833 | func TestHandleTopicTermination(t *testing.T) { |
| 2834 | topicName := "usrMe" |
| 2835 | numUsers := 1 |
| 2836 | helper := TopicTestHelper{} |
| 2837 | helper.setUp(t, numUsers, types.TopicCatMe, topicName /*attach=*/, true) |
| 2838 | defer helper.tearDown() |
| 2839 | |
| 2840 | done := make(chan bool, 1) |
| 2841 | exit := &shutDown{ |
| 2842 | reason: StopDeleted, |
| 2843 | done: done, |
| 2844 | } |
| 2845 | helper.topic.handleTopicTermination(exit) |
| 2846 | helper.finish() |
| 2847 | |
| 2848 | // Check for errors from testHubLoop |
| 2849 | if errorMsgs, hasError := helper.hubMessages["__ERROR__"]; hasError { |
| 2850 | t.Fatal(errorMsgs[0].Ctrl.Text) |
| 2851 | } |
| 2852 | |
| 2853 | if len(done) != 1 { |
| 2854 | t.Fatal("done callback isn't invoked.") |
| 2855 | } |
| 2856 | <-done |
| 2857 | for i, s := range helper.sessions { |
| 2858 | if len(s.detach) != 1 { |
| 2859 | t.Fatalf("Session %d: detach channel is empty.", i) |
| 2860 | } |
| 2861 | val := <-s.detach |
| 2862 | if val != topicName { |
| 2863 | t.Errorf("Session %d is expected to detach from topic '%s', found '%s'.", i, topicName, val) |
| 2864 | } |
| 2865 | } |
| 2866 | // Presence notifications. |
| 2867 | if len(helper.hubMessages) != 0 { |
| 2868 | t.Fatalf("Hub messages recipients: expected 0, received %d", len(helper.hubMessages)) |
| 2869 | } |
| 2870 | } |
| 2871 | |
| 2872 | func TestHandleBroadcastDataWithAttachments(t *testing.T) { |
| 2873 | numUsers := 2 |
nothing calls this directly
no test coverage detected
searching dependent graphs…