@webex/internal-plugin-lyra 3.0.0-beta.2 → 3.0.0-beta.21
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -3
- package/dist/config.js +0 -3
- package/dist/config.js.map +1 -1
- package/dist/device.js +1 -17
- package/dist/device.js.map +1 -1
- package/dist/index.js +1 -12
- package/dist/index.js.map +1 -1
- package/dist/lyra.js +2 -10
- package/dist/lyra.js.map +1 -1
- package/dist/space.js +20 -64
- package/dist/space.js.map +1 -1
- package/package.json +13 -13
- package/src/config.js +1 -2
- package/src/device.js +18 -17
- package/src/index.js +1 -1
- package/src/lyra.js +11 -11
- package/src/space.js +68 -64
- package/test/integration/spec/device.js +69 -48
- package/test/integration/spec/space.js +127 -82
- package/test/unit/spec/device.js +22 -15
- package/test/unit/spec/lyra.js +16 -11
- package/test/unit/spec/space.js +132 -71
package/test/unit/spec/space.js
CHANGED
|
@@ -12,13 +12,13 @@ describe('plugin-lyra', () => {
|
|
|
12
12
|
const lyraSpaceUrl = `https://lyra/api/v1/${lyraSpaceId}`;
|
|
13
13
|
const lyraSpace = {
|
|
14
14
|
identity: {
|
|
15
|
-
id: lyraSpaceId
|
|
15
|
+
id: lyraSpaceId,
|
|
16
16
|
},
|
|
17
|
-
url: lyraSpaceUrl
|
|
17
|
+
url: lyraSpaceUrl,
|
|
18
18
|
};
|
|
19
19
|
const conversation = {
|
|
20
20
|
url: 'https://conversation',
|
|
21
|
-
kmsResourceObjectUrl: 'https://kms'
|
|
21
|
+
kmsResourceObjectUrl: 'https://kms',
|
|
22
22
|
};
|
|
23
23
|
|
|
24
24
|
let webex;
|
|
@@ -26,13 +26,13 @@ describe('plugin-lyra', () => {
|
|
|
26
26
|
before(() => {
|
|
27
27
|
webex = new MockWebex({
|
|
28
28
|
children: {
|
|
29
|
-
lyra: Lyra
|
|
30
|
-
}
|
|
29
|
+
lyra: Lyra,
|
|
30
|
+
},
|
|
31
31
|
});
|
|
32
32
|
|
|
33
33
|
webex.internal.device = {
|
|
34
34
|
url: 'deviceUrl',
|
|
35
|
-
userId: '1234'
|
|
35
|
+
userId: '1234',
|
|
36
36
|
};
|
|
37
37
|
webex.config.lyra = lyraConfig.lyra;
|
|
38
38
|
});
|
|
@@ -43,86 +43,147 @@ describe('plugin-lyra', () => {
|
|
|
43
43
|
|
|
44
44
|
describe('space', () => {
|
|
45
45
|
describe('#get()', () => {
|
|
46
|
-
it('requires space.id', () =>
|
|
46
|
+
it('requires space.id', () =>
|
|
47
|
+
assert.isRejected(webex.internal.lyra.space.get(), /space.id is required/));
|
|
47
48
|
});
|
|
48
49
|
|
|
49
50
|
describe('#join()', () => {
|
|
50
|
-
it('defaults to MANUAL pass type', () =>
|
|
51
|
-
.then(() =>
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
51
|
+
it('defaults to MANUAL pass type', () =>
|
|
52
|
+
webex.internal.lyra.space.join(lyraSpace).then(() =>
|
|
53
|
+
assert.calledWith(
|
|
54
|
+
webex.request,
|
|
55
|
+
sinon.match({
|
|
56
|
+
method: 'PUT',
|
|
57
|
+
api: 'lyra',
|
|
58
|
+
resource: `${lyraSpace.url}/occupants/@me`,
|
|
59
|
+
body: {
|
|
60
|
+
pass: {
|
|
61
|
+
type: 'MANUAL',
|
|
62
|
+
},
|
|
63
|
+
deviceUrl: 'deviceUrl',
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
)
|
|
67
|
+
));
|
|
62
68
|
|
|
63
|
-
it('allows other pass type', () =>
|
|
64
|
-
.then(() =>
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
it('allows other pass type', () =>
|
|
70
|
+
webex.internal.lyra.space.join(lyraSpace, {passType: 'TEST'}).then(() =>
|
|
71
|
+
assert.calledWith(
|
|
72
|
+
webex.request,
|
|
73
|
+
sinon.match({
|
|
74
|
+
method: 'PUT',
|
|
75
|
+
api: 'lyra',
|
|
76
|
+
resource: `${lyraSpace.url}/occupants/@me`,
|
|
77
|
+
body: {
|
|
78
|
+
pass: {
|
|
79
|
+
type: 'TEST',
|
|
80
|
+
},
|
|
81
|
+
deviceUrl: 'deviceUrl',
|
|
82
|
+
},
|
|
83
|
+
})
|
|
84
|
+
)
|
|
85
|
+
));
|
|
75
86
|
|
|
76
|
-
it('allows another uri', () =>
|
|
77
|
-
.then(() =>
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
+
it('allows another uri', () =>
|
|
88
|
+
webex.internal.lyra.space.join(lyraSpace, {uri: 'https://customUrl'}).then(() =>
|
|
89
|
+
assert.calledWith(
|
|
90
|
+
webex.request,
|
|
91
|
+
sinon.match({
|
|
92
|
+
method: 'PUT',
|
|
93
|
+
uri: 'https://customUrl',
|
|
94
|
+
body: {
|
|
95
|
+
pass: {
|
|
96
|
+
type: 'MANUAL',
|
|
97
|
+
},
|
|
98
|
+
deviceUrl: 'deviceUrl',
|
|
99
|
+
},
|
|
100
|
+
})
|
|
101
|
+
)
|
|
102
|
+
));
|
|
87
103
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
104
|
+
it('passes on extra data field', () =>
|
|
105
|
+
webex.internal.lyra.space
|
|
106
|
+
.join(lyraSpace, {
|
|
107
|
+
passType: 'TEST',
|
|
108
|
+
data: {proof: 'abc'},
|
|
109
|
+
})
|
|
110
|
+
.then(() =>
|
|
111
|
+
assert.calledWith(
|
|
112
|
+
webex.request,
|
|
113
|
+
sinon.match({
|
|
114
|
+
method: 'PUT',
|
|
115
|
+
api: 'lyra',
|
|
116
|
+
resource: `${lyraSpace.url}/occupants/@me`,
|
|
117
|
+
body: {
|
|
118
|
+
pass: {
|
|
119
|
+
type: 'TEST',
|
|
120
|
+
data: {proof: 'abc'},
|
|
121
|
+
},
|
|
122
|
+
deviceUrl: 'deviceUrl',
|
|
123
|
+
},
|
|
124
|
+
})
|
|
125
|
+
)
|
|
126
|
+
));
|
|
105
127
|
});
|
|
106
128
|
|
|
107
129
|
describe('#bindConversation()', () => {
|
|
108
|
-
it('requires space.url', () =>
|
|
109
|
-
|
|
110
|
-
it('requires
|
|
111
|
-
|
|
130
|
+
it('requires space.url', () =>
|
|
131
|
+
assert.isRejected(webex.internal.lyra.space.bindConversation(), /space.url is required/));
|
|
132
|
+
it('requires space.id', () =>
|
|
133
|
+
assert.isRejected(
|
|
134
|
+
webex.internal.lyra.space.bindConversation({url: lyraSpaceUrl}),
|
|
135
|
+
/space.id is required/
|
|
136
|
+
));
|
|
137
|
+
it('requires conversation.url', () =>
|
|
138
|
+
assert.isRejected(
|
|
139
|
+
webex.internal.lyra.space.bindConversation(lyraSpace, {kmsResourceObjectUrl: 'url'}),
|
|
140
|
+
/conversation.url is required/
|
|
141
|
+
));
|
|
142
|
+
it('requires conversation.kmsResourceObjectUrl', () =>
|
|
143
|
+
assert.isRejected(
|
|
144
|
+
webex.internal.lyra.space.bindConversation(lyraSpace, {url: 'url'}),
|
|
145
|
+
/conversation.kmsResourceObjectUrl is required/
|
|
146
|
+
));
|
|
112
147
|
});
|
|
113
148
|
|
|
114
149
|
describe('#unbindConversation()', () => {
|
|
115
|
-
it('requires space.url', () =>
|
|
116
|
-
|
|
117
|
-
it('requires
|
|
118
|
-
|
|
150
|
+
it('requires space.url', () =>
|
|
151
|
+
assert.isRejected(webex.internal.lyra.space.unbindConversation(), /space.url is required/));
|
|
152
|
+
it('requires space.id', () =>
|
|
153
|
+
assert.isRejected(
|
|
154
|
+
webex.internal.lyra.space.unbindConversation({url: lyraSpaceUrl}),
|
|
155
|
+
/space.id is required/
|
|
156
|
+
));
|
|
157
|
+
it('requires conversation.url', () =>
|
|
158
|
+
assert.isRejected(
|
|
159
|
+
webex.internal.lyra.space.unbindConversation(lyraSpace, {kmsResourceObjectUrl: 'url'}),
|
|
160
|
+
/conversation.url is required/
|
|
161
|
+
));
|
|
162
|
+
it('requires conversation.kmsResourceObjectUrl', () =>
|
|
163
|
+
assert.isRejected(
|
|
164
|
+
webex.internal.lyra.space.unbindConversation(lyraSpace, {url: conversation.url}),
|
|
165
|
+
/conversation.kmsResourceObjectUrl is required/
|
|
166
|
+
));
|
|
119
167
|
});
|
|
120
168
|
|
|
121
169
|
describe('#deleteBinding', () => {
|
|
122
|
-
it('requires space.url', () =>
|
|
123
|
-
|
|
124
|
-
it('requires
|
|
125
|
-
|
|
170
|
+
it('requires space.url', () =>
|
|
171
|
+
assert.isRejected(webex.internal.lyra.space.deleteBinding(), /space.url is required/));
|
|
172
|
+
it('requires space.id', () =>
|
|
173
|
+
assert.isRejected(
|
|
174
|
+
webex.internal.lyra.space.deleteBinding({url: lyraSpaceUrl}),
|
|
175
|
+
/space.id is required/
|
|
176
|
+
));
|
|
177
|
+
it('requires options.kmsResourceObjectUrl', () =>
|
|
178
|
+
assert.isRejected(
|
|
179
|
+
webex.internal.lyra.space.deleteBinding(lyraSpace, {bindingId: '123'}),
|
|
180
|
+
/kmsResourceObjectUrl is required/
|
|
181
|
+
));
|
|
182
|
+
it('requires options.bindingId', () =>
|
|
183
|
+
assert.isRejected(
|
|
184
|
+
webex.internal.lyra.space.deleteBinding(lyraSpace, {kmsResourceObjectUrl: 'url'}),
|
|
185
|
+
/options.bindingId is required/
|
|
186
|
+
));
|
|
126
187
|
});
|
|
127
188
|
});
|
|
128
189
|
});
|