1 |
|
2 |
|
3 |
|
4 |
|
5 | import { TEST_HTTP_URL } from '../../test/mockHttp';
|
6 |
|
7 | import Http from './index';
|
8 |
|
9 | describe('Http', () => {
|
10 | let http;
|
11 |
|
12 | beforeEach(() => {
|
13 | http = new Http(TEST_HTTP_URL);
|
14 | });
|
15 |
|
16 | it('requires an http:// prefixed endpoint', () => {
|
17 | expect(
|
18 | () => new Http('ws://')
|
19 | ).toThrow(/with 'http/);
|
20 | });
|
21 |
|
22 | it('allows https:// endpoints', () => {
|
23 | expect(
|
24 | () => new Http('https://')
|
25 | ).not.toThrow();
|
26 | });
|
27 |
|
28 | it('always returns isConnected true', () => {
|
29 | expect(http.isConnected()).toEqual(true);
|
30 | });
|
31 |
|
32 | it('does not (yet) support subscribe', () => {
|
33 | return http.subscribe().catch((error) => {
|
34 | expect(error.message).toMatch(/does not have subscriptions/);
|
35 | });
|
36 | });
|
37 |
|
38 | it('does not (yet) support unsubscribe', () => {
|
39 | return http.unsubscribe().catch((error) => {
|
40 | expect(error.message).toMatch(/does not have subscriptions/);
|
41 | });
|
42 | });
|
43 | });
|