@webex/internal-plugin-avatar 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.
@@ -9,31 +9,58 @@ import MockWebex from '@webex/test-helper-mock-webex';
9
9
  /* eslint camelcase: 0 */
10
10
  describe('plugin-avatar', () => {
11
11
  const item1_40 = {
12
- uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0', size: 40, url: 'http://www-40.example.com', cacheControl: 300
12
+ uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0',
13
+ size: 40,
14
+ url: 'http://www-40.example.com',
15
+ cacheControl: 300,
13
16
  };
14
17
  const item1_50 = {
15
- uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0', size: 50, url: 'http://www-50.example.com', cacheControl: 300
18
+ uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0',
19
+ size: 50,
20
+ url: 'http://www-50.example.com',
21
+ cacheControl: 300,
16
22
  };
17
23
  const item1_80 = {
18
- uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0', size: 80, url: 'http://www-80.example.com', cacheControl: 300
24
+ uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0',
25
+ size: 80,
26
+ url: 'http://www-80.example.com',
27
+ cacheControl: 300,
19
28
  };
20
29
  const item1_110 = {
21
- uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0', size: 110, url: 'http://www-110.example.com', cacheControl: 300
30
+ uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0',
31
+ size: 110,
32
+ url: 'http://www-110.example.com',
33
+ cacheControl: 300,
22
34
  };
23
35
  const item1_192 = {
24
- uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0', size: 192, url: 'http://www-192.example.com', cacheControl: 300
36
+ uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0',
37
+ size: 192,
38
+ url: 'http://www-192.example.com',
39
+ cacheControl: 300,
25
40
  };
26
41
  const item1_640 = {
27
- uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0', size: 640, url: 'http://www-640.example.com', cacheControl: 300
42
+ uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0',
43
+ size: 640,
44
+ url: 'http://www-640.example.com',
45
+ cacheControl: 300,
28
46
  };
29
47
  const item1_1600 = {
30
- uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0', size: 1600, url: 'http://www-1600.example.com', cacheControl: 300
48
+ uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0',
49
+ size: 1600,
50
+ url: 'http://www-1600.example.com',
51
+ cacheControl: 300,
31
52
  };
32
53
  const item2_80 = {
33
- uuid: '88888888-4444-4444-4444-aaaaaaaaaaa1', size: 80, url: 'http://www2.example.com', cacheControl: 300
54
+ uuid: '88888888-4444-4444-4444-aaaaaaaaaaa1',
55
+ size: 80,
56
+ url: 'http://www2.example.com',
57
+ cacheControl: 300,
34
58
  };
35
59
  const item3_80 = {
36
- uuid: '88888888-4444-4444-4444-aaaaaaaaaaa2', size: 80, url: 'http://www3.example.com', cacheControl: 300
60
+ uuid: '88888888-4444-4444-4444-aaaaaaaaaaa2',
61
+ size: 80,
62
+ url: 'http://www3.example.com',
63
+ cacheControl: 300,
37
64
  };
38
65
 
39
66
  describe('AvatarUrlStore', () => {
@@ -43,60 +70,85 @@ describe('plugin-avatar', () => {
43
70
  beforeEach(() => {
44
71
  webex = new MockWebex({
45
72
  children: {
46
- avatar: Avatar
47
- }
73
+ avatar: Avatar,
74
+ },
48
75
  });
49
76
  store = webex.internal.avatar.store;
50
77
  });
51
78
 
52
- it('add item failures', () => Promise.all([
53
- assert.isRejected(store.add(), '`item` is required'),
54
- assert.isRejected(store.add({}), '`item.uuid` is required'),
55
- assert.isRejected(store.add({uuid: 'id1'}), '`item.size` is required'),
56
- assert.isRejected(store.add({uuid: 'id1', size: 80}), '`item.uuid` does not appear to be a uuid'),
57
- assert.isRejected(store.add({uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0', size: 80}), '`item.url` is required'),
58
- assert.isRejected(store.add({uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0', size: 80, url: 'http://www.example.com'}), '`item.cacheControl` is required'),
59
- assert.isRejected(store.add({
60
- uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0', size: 80, url: 'http://www.example.com', cacheControl: 0
61
- }), '`item.cacheControl` is required')
62
- ]));
79
+ it('add item failures', () =>
80
+ Promise.all([
81
+ assert.isRejected(store.add(), '`item` is required'),
82
+ assert.isRejected(store.add({}), '`item.uuid` is required'),
83
+ assert.isRejected(store.add({uuid: 'id1'}), '`item.size` is required'),
84
+ assert.isRejected(
85
+ store.add({uuid: 'id1', size: 80}),
86
+ '`item.uuid` does not appear to be a uuid'
87
+ ),
88
+ assert.isRejected(
89
+ store.add({uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0', size: 80}),
90
+ '`item.url` is required'
91
+ ),
92
+ assert.isRejected(
93
+ store.add({
94
+ uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0',
95
+ size: 80,
96
+ url: 'http://www.example.com',
97
+ }),
98
+ '`item.cacheControl` is required'
99
+ ),
100
+ assert.isRejected(
101
+ store.add({
102
+ uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0',
103
+ size: 80,
104
+ url: 'http://www.example.com',
105
+ cacheControl: 0,
106
+ }),
107
+ '`item.cacheControl` is required'
108
+ ),
109
+ ]));
63
110
 
64
- it('get item failures', () => Promise.all([
65
- assert.isRejected(store.get(), '`item` is required'),
66
- assert.isRejected(store.get({}), '`item.uuid` is required'),
67
- assert.isRejected(store.get({uuid: 'id1'}), '`item.size` is required'),
68
- assert.isRejected(store.get({uuid: 'id1', size: 80}), '`item.uuid` does not appear to be a uuid'),
69
- assert.isRejected(store.get({uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0', size: 80}), 'No URL found by specified id')
70
- ]));
111
+ it('get item failures', () =>
112
+ Promise.all([
113
+ assert.isRejected(store.get(), '`item` is required'),
114
+ assert.isRejected(store.get({}), '`item.uuid` is required'),
115
+ assert.isRejected(store.get({uuid: 'id1'}), '`item.size` is required'),
116
+ assert.isRejected(
117
+ store.get({uuid: 'id1', size: 80}),
118
+ '`item.uuid` does not appear to be a uuid'
119
+ ),
120
+ assert.isRejected(
121
+ store.get({uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0', size: 80}),
122
+ 'No URL found by specified id'
123
+ ),
124
+ ]));
71
125
 
72
- it('set / get / remove', () => Promise.all([
73
- store.add(item1_80),
74
- store.add(item2_80),
75
- store.add(item3_80),
76
- store.get(item1_80)
77
- .then((result) => assert.deepEqual(result, item1_80)),
78
- store.get(item2_80)
79
- .then((result) => assert.deepEqual(result, item2_80)),
80
- store.get(item3_80)
81
- .then((result) => assert.deepEqual(result, item3_80)),
82
- store.remove(item2_80),
83
- store.remove(item3_80),
84
- assert.isRejected(store.get(item3_80)),
85
- assert.isRejected(store.get(item2_80)),
86
- store.add(item1_40),
87
- store.add(item1_50),
88
- store.add(item1_110),
89
- store.add(item1_192),
90
- store.add(item1_640),
91
- store.add(item1_1600),
92
- store.remove({uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0'}),
93
- assert.isRejected(store.get(item1_40)),
94
- assert.isRejected(store.get(item1_50)),
95
- assert.isRejected(store.get(item1_80)),
96
- assert.isRejected(store.get(item1_110)),
97
- assert.isRejected(store.get(item1_192)),
98
- assert.isRejected(store.get(item1_640)),
99
- assert.isRejected(store.get(item1_1600))
100
- ]));
126
+ it('set / get / remove', () =>
127
+ Promise.all([
128
+ store.add(item1_80),
129
+ store.add(item2_80),
130
+ store.add(item3_80),
131
+ store.get(item1_80).then((result) => assert.deepEqual(result, item1_80)),
132
+ store.get(item2_80).then((result) => assert.deepEqual(result, item2_80)),
133
+ store.get(item3_80).then((result) => assert.deepEqual(result, item3_80)),
134
+ store.remove(item2_80),
135
+ store.remove(item3_80),
136
+ assert.isRejected(store.get(item3_80)),
137
+ assert.isRejected(store.get(item2_80)),
138
+ store.add(item1_40),
139
+ store.add(item1_50),
140
+ store.add(item1_110),
141
+ store.add(item1_192),
142
+ store.add(item1_640),
143
+ store.add(item1_1600),
144
+ store.remove({uuid: '88888888-4444-4444-4444-aaaaaaaaaaa0'}),
145
+ assert.isRejected(store.get(item1_40)),
146
+ assert.isRejected(store.get(item1_50)),
147
+ assert.isRejected(store.get(item1_80)),
148
+ assert.isRejected(store.get(item1_110)),
149
+ assert.isRejected(store.get(item1_192)),
150
+ assert.isRejected(store.get(item1_640)),
151
+ assert.isRejected(store.get(item1_1600)),
152
+ ]));
101
153
  });
102
154
  });