This repository was archived by the owner on Feb 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathindex_test.js
More file actions
113 lines (89 loc) · 2.54 KB
/
Copy pathindex_test.js
File metadata and controls
113 lines (89 loc) · 2.54 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
var expect = require('expect.js'),
mockery = require('mockery'),
path = require('path'),
pmock = require('pmock'),
Config = require('../src/config'),
BaseBackend = require('../src/backends/base.js'),
FeedManager = require('../src/FeedManager'),
main = require('../src/index');
describe('StreamBackend', function() {
it('should have right properties', function() {
new BaseBackend().should.have.property('collectReferences');
new BaseBackend().should.have.property('enrichActivities');
new BaseBackend().should.have.property('enrichAggregatedActivities');
});
it('#collectReferences()', function() {});
it('#retreiveObjects()', function() {});
it('#enrichActivities()', function() {});
it('#enrichAggregatedActivities()', function() {});
});
describe('feedManagerFactory', function() {
it('should return a FeedManager instance', function() {
var fm = main.feedManagerFactory({});
expect(fm).to.be.a(FeedManager);
});
it('should ignore unkown settings', function() {
var fm = main.feedManagerFactory({
unknown: 'abcdefg',
});
expect(fm).to.be.a(FeedManager);
expect(fm.settings.unknown).to.be.undefined;
});
it('should override known settings', function() {
var fm = main.feedManagerFactory({
apiKey: 'abcdefg',
});
expect(fm).to.be.a(FeedManager);
expect(fm.settings.apiKey).to.be('abcdefg');
});
});
describe('Config', function() {
it('default config', function() {
var settings = main.FeedManager.settings;
var expected = require('../getstream.js').config;
expect(settings).to.eql(expected);
});
});
describe.skip('Config Env Var', function() {
var configFile = '/tmp/getstream.js';
before(function() {
this.env = pmock.env({
STREAM_NODE_CONFIG_PATH: configFile,
});
mockery.enable({
warnOnUnregistered: false,
useCleanCache: true,
});
mockery.registerMock('fs', {
existsSync: function() {
return true;
},
});
mockery.registerMock(configFile, { config: { apiKey: 12345 } });
});
after(function() {
mockery.disable();
this.env.reset();
});
/**
* Mockery doesn't work correctly here
* SKip this test until we fix that
*/
it.skip('env var config dir', function() {
var settings = Config();
expect(settings.apiKey).to.be(12345);
});
});
describe('Config Default', function() {
before(function() {
this.cwd = pmock.cwd('/tmp');
});
after(function() {
this.cwd.reset();
});
it('env var config dir', function() {
var settings = Config();
var expected = require('../src/config.default.js').config;
expect(settings).to.eql(expected);
});
});