-
Notifications
You must be signed in to change notification settings - Fork 53
/
main.spec.js
31 lines (27 loc) · 970 Bytes
/
main.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
describe('eztz.node', () => {
let node;
let main;
let eztz;
beforeEach(() => {
main = require('./src/main');
node = main.eztz.node;
});
test('should have activeProvider set to defaultProvider', () => {
expect(node.activeProvider).toBe(main.defaultProvider);
});
test('should provide setProvider method to be able to configure defaultProvider', () => {
const previousProvider = node.activeProvider;
const newProvider = 'http://example.com/rpc';
node.setProvider(newProvider);
expect(node.activeProvider).toBe(newProvider);
expect(node.activeProvider).not.toBe(previousProvider);
});
test('should provide resetProvider method', () => {
const defaultProvider = node.activeProvider;
const newProvider = 'http://example.com/rpc';
node.setProvider(newProvider);
expect(node.activeProvider).toBe(newProvider);
node.resetProvider();
expect(node.activeProvider).not.toBe(defaultProvider);
});
});