@webex/internal-plugin-conversation 3.0.0-beta.9 → 3.0.0-bnr.0
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/activities.js +8 -69
- package/dist/activities.js.map +1 -1
- package/dist/activity-thread-ordering.js +19 -79
- package/dist/activity-thread-ordering.js.map +1 -1
- package/dist/config.js +1 -7
- package/dist/config.js.map +1 -1
- package/dist/constants.js +4 -5
- package/dist/constants.js.map +1 -1
- package/dist/conversation.js +790 -1199
- package/dist/conversation.js.map +1 -1
- package/dist/convo-error.js +0 -23
- package/dist/convo-error.js.map +1 -1
- package/dist/decryption-transforms.js +35 -98
- package/dist/decryption-transforms.js.map +1 -1
- package/dist/encryption-transforms.js +11 -48
- package/dist/encryption-transforms.js.map +1 -1
- package/dist/index.js +7 -50
- package/dist/index.js.map +1 -1
- package/dist/internal-plugin-conversation.d.ts +21 -0
- package/dist/share-activity.js +40 -106
- package/dist/share-activity.js.map +1 -1
- package/dist/to-array.js +9 -11
- package/dist/to-array.js.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/types/activities.d.ts +32 -0
- package/dist/types/activity-thread-ordering.d.ts +18 -0
- package/dist/types/config.d.ts +19 -0
- package/dist/types/constants.d.ts +5 -0
- package/dist/types/conversation.d.ts +2 -0
- package/dist/types/convo-error.d.ts +10 -0
- package/dist/types/decryption-transforms.d.ts +1 -0
- package/dist/types/encryption-transforms.d.ts +1 -0
- package/dist/types/index.d.ts +3 -0
- package/dist/types/share-activity.d.ts +7 -0
- package/dist/types/to-array.d.ts +9 -0
- package/package.json +15 -15
- package/src/activities.js +10 -7
- package/src/activity-thread-ordering.js +27 -30
- package/src/activity-threading.md +68 -49
- package/src/config.js +5 -5
- package/src/conversation.js +621 -589
- package/src/decryption-transforms.js +103 -62
- package/src/encryption-transforms.js +103 -83
- package/src/index.js +82 -66
- package/src/share-activity.js +64 -55
- package/src/to-array.js +2 -2
- package/test/integration/spec/create.js +184 -118
- package/test/integration/spec/encryption.js +250 -186
- package/test/integration/spec/get.js +761 -513
- package/test/integration/spec/mercury.js +37 -27
- package/test/integration/spec/share.js +292 -229
- package/test/integration/spec/verbs.js +628 -441
- package/test/unit/spec/conversation.js +265 -163
- package/test/unit/spec/decrypt-transforms.js +112 -131
- package/test/unit/spec/encryption-transforms.js +24 -18
- package/test/unit/spec/share-activity.js +37 -40
|
@@ -8,7 +8,6 @@ import sinon from 'sinon';
|
|
|
8
8
|
import MockWebex from '@webex/test-helper-mock-webex';
|
|
9
9
|
import sha256 from 'crypto-js/sha256';
|
|
10
10
|
|
|
11
|
-
|
|
12
11
|
describe('plugin-conversation', () => {
|
|
13
12
|
describe('ShareActivity', () => {
|
|
14
13
|
let shareActivity;
|
|
@@ -19,46 +18,31 @@ describe('plugin-conversation', () => {
|
|
|
19
18
|
|
|
20
19
|
describe('#_determineContentCategory', () => {
|
|
21
20
|
it('returns "documents" when not all files have a mimeType', () => {
|
|
22
|
-
const items = [
|
|
23
|
-
{mimeType: 'image/png'},
|
|
24
|
-
{}
|
|
25
|
-
];
|
|
21
|
+
const items = [{mimeType: 'image/png'}, {}];
|
|
26
22
|
|
|
27
23
|
assert.equal(shareActivity._determineContentCategory(items), 'documents');
|
|
28
24
|
});
|
|
29
25
|
|
|
30
26
|
it('returns "documents" for non-homogenous mimeTypes', () => {
|
|
31
|
-
const items = [
|
|
32
|
-
{mimeType: 'image/png'},
|
|
33
|
-
{mimeType: 'video/h264'}
|
|
34
|
-
];
|
|
27
|
+
const items = [{mimeType: 'image/png'}, {mimeType: 'video/h264'}];
|
|
35
28
|
|
|
36
29
|
assert.equal(shareActivity._determineContentCategory(items), 'documents');
|
|
37
30
|
});
|
|
38
31
|
|
|
39
32
|
it('returns "documents" if the potentially homogenous mimeType is not image or video', () => {
|
|
40
|
-
const items = [
|
|
41
|
-
{mimeType: 'application/xml'},
|
|
42
|
-
{mimeType: 'application/xml'}
|
|
43
|
-
];
|
|
33
|
+
const items = [{mimeType: 'application/xml'}, {mimeType: 'application/xml'}];
|
|
44
34
|
|
|
45
35
|
assert.equal(shareActivity._determineContentCategory(items), 'documents');
|
|
46
36
|
});
|
|
47
37
|
|
|
48
38
|
it('returns "image" if all mimeTypes are image', () => {
|
|
49
|
-
const items = [
|
|
50
|
-
{mimeType: 'image/png'},
|
|
51
|
-
{mimeType: 'image/jpg'}
|
|
52
|
-
];
|
|
39
|
+
const items = [{mimeType: 'image/png'}, {mimeType: 'image/jpg'}];
|
|
53
40
|
|
|
54
41
|
assert.equal(shareActivity._determineContentCategory(items), 'images');
|
|
55
42
|
});
|
|
56
43
|
|
|
57
44
|
it('returns "video" if all mimeTypes are video', () => {
|
|
58
|
-
const items = [
|
|
59
|
-
{mimeType: 'video/h264'},
|
|
60
|
-
{mimeType: 'video/vp8'}
|
|
61
|
-
];
|
|
45
|
+
const items = [{mimeType: 'video/h264'}, {mimeType: 'video/vp8'}];
|
|
62
46
|
|
|
63
47
|
assert.equal(shareActivity._determineContentCategory(items), 'videos');
|
|
64
48
|
});
|
|
@@ -67,12 +51,14 @@ describe('plugin-conversation', () => {
|
|
|
67
51
|
const items = [
|
|
68
52
|
{
|
|
69
53
|
mimeType: 'image/png',
|
|
70
|
-
actions: [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
54
|
+
actions: [
|
|
55
|
+
{
|
|
56
|
+
mimeType: 'application/x-cisco-webex-whiteboard',
|
|
57
|
+
type: 'edit',
|
|
58
|
+
url: 'https://boards.example.com/boards/1',
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
},
|
|
76
62
|
];
|
|
77
63
|
|
|
78
64
|
assert.equal(shareActivity._determineContentCategory(items), 'documents');
|
|
@@ -81,16 +67,20 @@ describe('plugin-conversation', () => {
|
|
|
81
67
|
describe('#upload', () => {
|
|
82
68
|
let shareActivityUpload;
|
|
83
69
|
let webex;
|
|
84
|
-
const fakeURL =
|
|
70
|
+
const fakeURL =
|
|
71
|
+
'https://encryption-a.wbx2.com/encryption/api/v1/keys/8a7d3d78-ce75-48aa-a943-2e8acf63fbc9';
|
|
85
72
|
|
|
86
73
|
beforeEach(() => {
|
|
87
74
|
webex = new MockWebex({
|
|
88
|
-
upload: sinon.stub().returns(Promise.resolve({body: {downloadUrl: fakeURL}}))
|
|
75
|
+
upload: sinon.stub().returns(Promise.resolve({body: {downloadUrl: fakeURL}})),
|
|
89
76
|
});
|
|
90
77
|
|
|
91
|
-
shareActivityUpload = new ShareActivity(
|
|
92
|
-
|
|
93
|
-
|
|
78
|
+
shareActivityUpload = new ShareActivity(
|
|
79
|
+
{},
|
|
80
|
+
{
|
|
81
|
+
parent: webex,
|
|
82
|
+
}
|
|
83
|
+
);
|
|
94
84
|
});
|
|
95
85
|
|
|
96
86
|
it('checks whether filehash is sent in body while making a call to /finish API', () => {
|
|
@@ -101,15 +91,15 @@ describe('plugin-conversation', () => {
|
|
|
101
91
|
const inputData = {
|
|
102
92
|
phases: {
|
|
103
93
|
initialize: {
|
|
104
|
-
fileSize
|
|
94
|
+
fileSize,
|
|
105
95
|
},
|
|
106
96
|
finalize: {
|
|
107
97
|
body: {
|
|
108
98
|
fileSize,
|
|
109
|
-
fileHash
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
}
|
|
99
|
+
fileHash,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
113
103
|
};
|
|
114
104
|
|
|
115
105
|
spy(inputData);
|
|
@@ -147,10 +137,18 @@ describe('plugin-conversation', () => {
|
|
|
147
137
|
|
|
148
138
|
describe('#addGif', () => {
|
|
149
139
|
const fakeHappyGif = {
|
|
150
|
-
name: 'happy gif.gif',
|
|
140
|
+
name: 'happy gif.gif',
|
|
141
|
+
url: '/path/gif.gif',
|
|
142
|
+
height: 200,
|
|
143
|
+
width: 270,
|
|
144
|
+
image: {height: 200, width: 270, url: '/path/thumbnailgif.gif'},
|
|
151
145
|
};
|
|
152
146
|
const fakeSadGif = {
|
|
153
|
-
name: 'sad-gif.gif',
|
|
147
|
+
name: 'sad-gif.gif',
|
|
148
|
+
url: '/path/gif.gif',
|
|
149
|
+
height: 200,
|
|
150
|
+
width: 270,
|
|
151
|
+
image: {height: 200, width: 270, url: '/path/thumbnailgif.gif'},
|
|
154
152
|
};
|
|
155
153
|
|
|
156
154
|
it('adds gif to empty this.uploads', () => {
|
|
@@ -160,7 +158,6 @@ describe('plugin-conversation', () => {
|
|
|
160
158
|
assert.isTrue(shareActivity.uploads.size === 1);
|
|
161
159
|
});
|
|
162
160
|
|
|
163
|
-
|
|
164
161
|
it('if the giphy already exists, then do not add to this.uploads', () => {
|
|
165
162
|
shareActivity.uploads.set(fakeHappyGif, {}); // add fake gif preemptively, mocking that we already added a gif
|
|
166
163
|
shareActivity.addGif(fakeHappyGif); // attempt to add the same gif again
|