UNPKG

1.54 kBJavaScriptView Raw
1const {consoleLogger, newInMemoryStorage} = require("cyclon.p2p-common");
2const {Builder} = require('../lib/Builder');
3
4describe('the builder', () => {
5
6 it('will build a comms and bootstrap instance', () => {
7 const builderResult = new Builder().build();
8 expect(builderResult.comms).toBeDefined();
9 expect(builderResult.bootstrap).toBeDefined();
10 });
11
12 it('will return the same result if built multiple times', () => {
13 let builder = new Builder();
14 const result1 = builder.build();
15 const result2 = builder.build();
16 expect(result1).toBe(result2);
17 });
18
19 it('should allow setting of logger', () => {
20 expect(new Builder().withLogger(consoleLogger()).build()).toBeDefined();
21 });
22
23 it('should allow setting of storage', () => {
24 expect(new Builder().withStorage(newInMemoryStorage()).build()).toBeDefined();
25 });
26
27 it('should allow setting of signalling servers', () => {
28 expect(new Builder().withSignallingServers([]).build()).toBeDefined();
29 });
30
31 it('should allow setting of signalling server reconnect delay', () => {
32 expect(new Builder().withSignallingServerReconnectDelay(1000).build()).toBeDefined();
33 });
34
35 it('should allow setting of ice servers', () => {
36 expect(new Builder().withIceServers([]).build()).toBeDefined();
37 });
38
39 it('should allow setting of channel state change timeout', () => {
40 expect(new Builder().withChannelStateChangeTimeout(1000).build()).toBeDefined();
41 });
42});