seatsio 68.0.0 → 69.0.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/package.json +3 -3
- package/src/Events/Channels.js +52 -0
- package/src/Events/Events.js +2 -8
- package/tests/eventReports/eventReport.test.js +6 -6
- package/tests/eventReports/eventReportSummary.test.js +2 -2
- package/tests/events/bookObject.test.js +4 -4
- package/tests/events/changeBestAvailableObjectStatus.test.js +4 -4
- package/tests/events/changeObjectStatus.test.js +4 -4
- package/tests/events/changeObjectStatusInBatch.test.js +4 -4
- package/tests/events/channels/addChannel.test.js +77 -0
- package/tests/events/channels/addObjectToChannel.test.js +34 -0
- package/tests/events/channels/removeChannel.test.js +26 -0
- package/tests/events/channels/removeObjectsFromChannel.test.js +25 -0
- package/tests/events/{assignObjectsToChannels.test.js → channels/replaceChannels.test.js} +4 -4
- package/tests/events/{updateChannels.test.js → channels/setObjectsForChannelsTest.js} +3 -3
- package/tests/events/channels/updateChannel.test.js +65 -0
- package/tests/events/holdObjects.test.js +4 -4
- package/tests/events/listAllStatusChanges.test.js +39 -33
- package/tests/events/listStatusChangesForObjects.test.js +9 -5
- package/tests/events/releaseObjects.test.js +4 -4
- package/tests/testUtils.js +26 -1
- package/tests/events/listStatusChangesAfter.test.js +0 -251
- package/tests/events/listStatusChangesBefore.test.js +0 -246
- package/tests/events/listStatusChangesFirstPage.test.js +0 -479
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "seatsio",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "69.0.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"description": "Official JavaScript and Node.JS client library for the Seats.io REST API",
|
|
6
6
|
"license": "MIT",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"gulp-tap": "latest",
|
|
31
31
|
"gulp-uglify": "latest",
|
|
32
32
|
"gulp-uglify-es": "latest",
|
|
33
|
-
"jest": "28.0
|
|
34
|
-
"jest-cli": "28.0
|
|
33
|
+
"jest": "28.1.0",
|
|
34
|
+
"jest-cli": "28.1.0",
|
|
35
35
|
"uuid": "8.3.2"
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
class Channels {
|
|
2
|
+
/**
|
|
3
|
+
* @param {Axios} client
|
|
4
|
+
*/
|
|
5
|
+
constructor (client) {
|
|
6
|
+
this.client = client
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
add (eventKey, channelKey, name, color, index, objects) {
|
|
10
|
+
return this.client.post(`/events/${encodeURIComponent(eventKey)}/channels`, {
|
|
11
|
+
key: channelKey,
|
|
12
|
+
name: name,
|
|
13
|
+
color: color,
|
|
14
|
+
index: index,
|
|
15
|
+
objects: objects
|
|
16
|
+
})
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
remove (eventKey, channelKey) {
|
|
20
|
+
return this.client.delete(`/events/${encodeURIComponent(eventKey)}/channels/${encodeURIComponent(channelKey)}`)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
update (eventKey, channelKey, newChannelName, newColor, newObjects) {
|
|
24
|
+
return this.client.post(`/events/${encodeURIComponent(eventKey)}/channels/${encodeURIComponent(channelKey)}`, {
|
|
25
|
+
name: newChannelName,
|
|
26
|
+
color: newColor,
|
|
27
|
+
objects: newObjects
|
|
28
|
+
})
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
addObjects (eventKey, channelKey, objects) {
|
|
32
|
+
return this.client.post(`/events/${encodeURIComponent(eventKey)}/channels/${encodeURIComponent(channelKey)}/objects`, {
|
|
33
|
+
objects: objects
|
|
34
|
+
})
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
removeObjects (eventKey, channelKey, objects) {
|
|
38
|
+
return this.client.delete(`/events/${encodeURIComponent(eventKey)}/channels/${encodeURIComponent(channelKey)}/objects`, {
|
|
39
|
+
data: { objects: objects }
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
replace (eventKey, channels) {
|
|
44
|
+
return this.client.post(`/events/${encodeURIComponent(eventKey)}/channels/update`, { channels: channels })
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
setObjects (eventKey, channelConfig) {
|
|
48
|
+
return this.client.post(`/events/${encodeURIComponent(eventKey)}/channels/assign-objects`, { channelConfig: channelConfig })
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
module.exports = Channels
|
package/src/Events/Events.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const Page = require('../Page.js')
|
|
2
2
|
const Lister = require('../Lister.js')
|
|
3
3
|
const EventObjectInfo = require('./EventObjectInfo.js')
|
|
4
|
+
const Channels = require('./Channels.js')
|
|
4
5
|
const StatusChange = require('./StatusChange.js')
|
|
5
6
|
const BestAvailableObjects = require('./BestAvailableObjects.js')
|
|
6
7
|
const ChangeObjectStatusResult = require('./ChangeObjectStatusResult.js')
|
|
@@ -12,6 +13,7 @@ class Events {
|
|
|
12
13
|
*/
|
|
13
14
|
constructor (client) {
|
|
14
15
|
this.client = client
|
|
16
|
+
this.channels = new Channels(this.client)
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
/* @return Event */
|
|
@@ -57,14 +59,6 @@ class Events {
|
|
|
57
59
|
.then((res) => new EventDeserializer().fromJson(res.data))
|
|
58
60
|
}
|
|
59
61
|
|
|
60
|
-
updateChannels (eventKey, channels) {
|
|
61
|
-
return this.client.post(`/events/${encodeURIComponent(eventKey)}/channels/update`, { channels: channels })
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
assignObjectsToChannel (eventKey, channelConfig) {
|
|
65
|
-
return this.client.post(`/events/${encodeURIComponent(eventKey)}/channels/assign-objects`, { channelConfig: channelConfig })
|
|
66
|
-
}
|
|
67
|
-
|
|
68
62
|
/**
|
|
69
63
|
* @param {string} eventKey
|
|
70
64
|
* @param {?string} chartKey
|
|
@@ -10,10 +10,10 @@ test('report properties', async () => {
|
|
|
10
10
|
const event = await client.events.create(chartKey)
|
|
11
11
|
const extraData = { foo: 'bar' }
|
|
12
12
|
await client.events.book(event.key, (new ObjectProperties('A-1')).setTicketType('ticketType1').setExtraData(extraData), null, 'order1')
|
|
13
|
-
await client.events.
|
|
13
|
+
await client.events.channels.replace(event.key, {
|
|
14
14
|
channel1: { name: 'channel 1', color: 'blue', index: 1 }
|
|
15
15
|
})
|
|
16
|
-
await client.events.
|
|
16
|
+
await client.events.channels.setObjects(event.key, { channel1: ['A-1'] })
|
|
17
17
|
|
|
18
18
|
const report = await client.eventReports.byLabel(event.key)
|
|
19
19
|
|
|
@@ -316,10 +316,10 @@ test('report by channel', async () => {
|
|
|
316
316
|
const chartKey = testUtils.getChartKey()
|
|
317
317
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
318
318
|
const event = await client.events.create(chartKey)
|
|
319
|
-
await client.events.
|
|
319
|
+
await client.events.channels.replace(event.key, {
|
|
320
320
|
channel1: { name: 'channel 1', color: 'blue', index: 1 }
|
|
321
321
|
})
|
|
322
|
-
await client.events.
|
|
322
|
+
await client.events.channels.setObjects(event.key, { channel1: ['A-1', 'A-2'] })
|
|
323
323
|
|
|
324
324
|
const report = await client.eventReports.byChannel(event.key)
|
|
325
325
|
|
|
@@ -332,10 +332,10 @@ test('report by specific channel', async () => {
|
|
|
332
332
|
const chartKey = testUtils.getChartKey()
|
|
333
333
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
334
334
|
const event = await client.events.create(chartKey)
|
|
335
|
-
await client.events.
|
|
335
|
+
await client.events.channels.replace(event.key, {
|
|
336
336
|
channel1: { name: 'channel 1', color: 'blue', index: 1 }
|
|
337
337
|
})
|
|
338
|
-
await client.events.
|
|
338
|
+
await client.events.channels.setObjects(event.key, { channel1: ['A-1', 'A-2'] })
|
|
339
339
|
|
|
340
340
|
const report = await client.eventReports.byChannel(event.key, 'channel1')
|
|
341
341
|
|
|
@@ -354,10 +354,10 @@ test('summaryByChannel', async () => {
|
|
|
354
354
|
const chartKey = testUtils.getChartKey()
|
|
355
355
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
356
356
|
const event = await client.events.create(chartKey)
|
|
357
|
-
await client.events.
|
|
357
|
+
await client.events.channels.replace(event.key, {
|
|
358
358
|
channel1: { name: 'channel 1', color: 'blue', index: 1 }
|
|
359
359
|
})
|
|
360
|
-
await client.events.
|
|
360
|
+
await client.events.channels.setObjects(event.key, { channel1: ['A-1', 'A-2'] })
|
|
361
361
|
|
|
362
362
|
const report = await client.eventReports.summaryByChannel(event.key)
|
|
363
363
|
|
|
@@ -100,10 +100,10 @@ test('should accept channel keys', async () => {
|
|
|
100
100
|
const chartKey = testUtils.getChartKey()
|
|
101
101
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
102
102
|
const event = await client.events.create(chartKey)
|
|
103
|
-
await client.events.
|
|
103
|
+
await client.events.channels.replace(event.key, {
|
|
104
104
|
channelKey1: { name: 'channel 1', color: '#FFAABB', index: 1 }
|
|
105
105
|
})
|
|
106
|
-
await client.events.
|
|
106
|
+
await client.events.channels.setObjects(event.key, { channelKey1: ['A-1'] })
|
|
107
107
|
|
|
108
108
|
await client.events.book(event.key, ['A-1'], null, null, null, null, ['channelKey1'])
|
|
109
109
|
|
|
@@ -116,10 +116,10 @@ test('should accept ignoreChannels', async () => {
|
|
|
116
116
|
const chartKey = testUtils.getChartKey()
|
|
117
117
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
118
118
|
const event = await client.events.create(chartKey)
|
|
119
|
-
await client.events.
|
|
119
|
+
await client.events.channels.replace(event.key, {
|
|
120
120
|
channelKey1: { name: 'channel 1', color: '#FFAABB', index: 1 }
|
|
121
121
|
})
|
|
122
|
-
await client.events.
|
|
122
|
+
await client.events.channels.setObjects(event.key, { channelKey1: ['A-1'] })
|
|
123
123
|
|
|
124
124
|
await client.events.book(event.key, ['A-1'], null, null, null, true)
|
|
125
125
|
|
|
@@ -178,10 +178,10 @@ test('should accept channel keys', async () => {
|
|
|
178
178
|
const chartKey = testUtils.getChartKey()
|
|
179
179
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
180
180
|
const event = await client.events.create(chartKey)
|
|
181
|
-
await client.events.
|
|
181
|
+
await client.events.channels.replace(event.key, {
|
|
182
182
|
channelKey1: { name: 'channel 1', color: '#FFAABB', index: 1 }
|
|
183
183
|
})
|
|
184
|
-
await client.events.
|
|
184
|
+
await client.events.channels.setObjects(event.key, { channelKey1: ['B-6'] })
|
|
185
185
|
|
|
186
186
|
const bestAvailableObjs = await client.events.changeBestAvailableObjectStatus(event.key, 1, 'lolzor', null, null, null, null, null, null, null, ['channelKey1'])
|
|
187
187
|
|
|
@@ -193,10 +193,10 @@ test('should accept ignoreChannels', async () => {
|
|
|
193
193
|
const chartKey = testUtils.getChartKey()
|
|
194
194
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
195
195
|
const event = await client.events.create(chartKey)
|
|
196
|
-
await client.events.
|
|
196
|
+
await client.events.channels.replace(event.key, {
|
|
197
197
|
channelKey1: { name: 'channel 1', color: '#FFAABB', index: 1 }
|
|
198
198
|
})
|
|
199
|
-
await client.events.
|
|
199
|
+
await client.events.channels.setObjects(event.key, { channelKey1: ['A-1'] })
|
|
200
200
|
|
|
201
201
|
const bestAvailableObjs = await client.events.changeBestAvailableObjectStatus(event.key, 1, 'lolzor', null, null, null, null, null, null, true)
|
|
202
202
|
|
|
@@ -178,14 +178,14 @@ test('should accept channel keys', async () => {
|
|
|
178
178
|
const chartKey = testUtils.getChartKey()
|
|
179
179
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
180
180
|
const event = await client.events.create(chartKey)
|
|
181
|
-
await client.events.
|
|
181
|
+
await client.events.channels.replace(event.key, {
|
|
182
182
|
channelKey1: {
|
|
183
183
|
name: 'channel 1',
|
|
184
184
|
color: '#FFAABB',
|
|
185
185
|
index: 1
|
|
186
186
|
}
|
|
187
187
|
})
|
|
188
|
-
await client.events.
|
|
188
|
+
await client.events.channels.setObjects(event.key, {
|
|
189
189
|
channelKey1: ['A-1', 'A-2']
|
|
190
190
|
})
|
|
191
191
|
await client.events.changeObjectStatus(event.key, ['A-1'], 'someStatus', null, null, null, null, ['channelKey1'])
|
|
@@ -199,14 +199,14 @@ test('should accept ignoreChannels', async () => {
|
|
|
199
199
|
const chartKey = testUtils.getChartKey()
|
|
200
200
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
201
201
|
const event = await client.events.create(chartKey)
|
|
202
|
-
await client.events.
|
|
202
|
+
await client.events.channels.replace(event.key, {
|
|
203
203
|
channelKey1: {
|
|
204
204
|
name: 'channel 1',
|
|
205
205
|
color: '#FFAABB',
|
|
206
206
|
index: 1
|
|
207
207
|
}
|
|
208
208
|
})
|
|
209
|
-
await client.events.
|
|
209
|
+
await client.events.channels.setObjects(event.key, {
|
|
210
210
|
channelKey1: ['A-1', 'A-2']
|
|
211
211
|
})
|
|
212
212
|
await client.events.changeObjectStatus(event.key, ['A-1'], 'someStatus', null, null, null, true)
|
|
@@ -31,14 +31,14 @@ test('should accept channel keys', async () => {
|
|
|
31
31
|
const chartKey = testUtils.getChartKey()
|
|
32
32
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
33
33
|
const event = await client.events.create(chartKey)
|
|
34
|
-
await client.events.
|
|
34
|
+
await client.events.channels.replace(event.key, {
|
|
35
35
|
channelKey1: {
|
|
36
36
|
name: 'channel 1',
|
|
37
37
|
color: '#FFAABB',
|
|
38
38
|
index: 1
|
|
39
39
|
}
|
|
40
40
|
})
|
|
41
|
-
await client.events.
|
|
41
|
+
await client.events.channels.setObjects(event.key, {
|
|
42
42
|
channelKey1: ['A-1']
|
|
43
43
|
})
|
|
44
44
|
|
|
@@ -54,14 +54,14 @@ test('should accept ignoreChannels', async () => {
|
|
|
54
54
|
const chartKey = testUtils.getChartKey()
|
|
55
55
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
56
56
|
const event = await client.events.create(chartKey)
|
|
57
|
-
await client.events.
|
|
57
|
+
await client.events.channels.replace(event.key, {
|
|
58
58
|
channelKey1: {
|
|
59
59
|
name: 'channel 1',
|
|
60
60
|
color: '#FFAABB',
|
|
61
61
|
index: 1
|
|
62
62
|
}
|
|
63
63
|
})
|
|
64
|
-
await client.events.
|
|
64
|
+
await client.events.channels.setObjects(event.key, {
|
|
65
65
|
channelKey1: ['A-1', 'A-2']
|
|
66
66
|
})
|
|
67
67
|
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
const testUtils = require('../../testUtils')
|
|
2
|
+
const Channel = require('../../../src/Events/Channel')
|
|
3
|
+
test('can add a channel', async () => {
|
|
4
|
+
const {
|
|
5
|
+
client,
|
|
6
|
+
user
|
|
7
|
+
} = await testUtils.createTestUserAndClient()
|
|
8
|
+
const chartKey = testUtils.getChartKey()
|
|
9
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
10
|
+
const event = await client.events.create(chartKey)
|
|
11
|
+
|
|
12
|
+
await client.events.channels.add(event.key, 'channelKey1', 'channel 1', '#FFFF98', 1, ['A-1', 'A-2'])
|
|
13
|
+
await client.events.channels.add(event.key, 'channelKey2', 'channel 2', '#FFFF99', 2, ['A-3'])
|
|
14
|
+
|
|
15
|
+
const retrievedEvent = await client.events.retrieve(event.key)
|
|
16
|
+
expect(retrievedEvent.channels).toEqual([
|
|
17
|
+
new Channel({
|
|
18
|
+
key: 'channelKey1',
|
|
19
|
+
name: 'channel 1',
|
|
20
|
+
color: '#FFFF98',
|
|
21
|
+
index: 1,
|
|
22
|
+
objects: ['A-1', 'A-2']
|
|
23
|
+
}),
|
|
24
|
+
new Channel({
|
|
25
|
+
key: 'channelKey2',
|
|
26
|
+
name: 'channel 2',
|
|
27
|
+
color: '#FFFF99',
|
|
28
|
+
index: 2,
|
|
29
|
+
objects: ['A-3']
|
|
30
|
+
})
|
|
31
|
+
])
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
test('index is optional', async () => {
|
|
35
|
+
const {
|
|
36
|
+
client,
|
|
37
|
+
user
|
|
38
|
+
} = await testUtils.createTestUserAndClient()
|
|
39
|
+
const chartKey = testUtils.getChartKey()
|
|
40
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
41
|
+
const event = await client.events.create(chartKey)
|
|
42
|
+
|
|
43
|
+
await client.events.channels.add(event.key, 'channelKey1', 'channel 1', '#FFFF98', undefined, ['A-1', 'A-2'])
|
|
44
|
+
|
|
45
|
+
const retrievedEvent = await client.events.retrieve(event.key)
|
|
46
|
+
expect(retrievedEvent.channels).toEqual([
|
|
47
|
+
new Channel({
|
|
48
|
+
key: 'channelKey1',
|
|
49
|
+
name: 'channel 1',
|
|
50
|
+
color: '#FFFF98',
|
|
51
|
+
objects: ['A-1', 'A-2']
|
|
52
|
+
})
|
|
53
|
+
])
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test('objects are optional', async () => {
|
|
57
|
+
const {
|
|
58
|
+
client,
|
|
59
|
+
user
|
|
60
|
+
} = await testUtils.createTestUserAndClient()
|
|
61
|
+
const chartKey = testUtils.getChartKey()
|
|
62
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
63
|
+
const event = await client.events.create(chartKey)
|
|
64
|
+
|
|
65
|
+
await client.events.channels.add(event.key, 'channelKey1', 'channel 1', '#FFFF98', 1, undefined)
|
|
66
|
+
|
|
67
|
+
const retrievedEvent = await client.events.retrieve(event.key)
|
|
68
|
+
expect(retrievedEvent.channels).toEqual([
|
|
69
|
+
new Channel({
|
|
70
|
+
key: 'channelKey1',
|
|
71
|
+
name: 'channel 1',
|
|
72
|
+
color: '#FFFF98',
|
|
73
|
+
index: 1,
|
|
74
|
+
objects: []
|
|
75
|
+
})
|
|
76
|
+
])
|
|
77
|
+
})
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
const testUtils = require('../../testUtils')
|
|
2
|
+
const Channel = require('../../../src/Events/Channel')
|
|
3
|
+
|
|
4
|
+
test('can add objects, moving them from one channel to another', async () => {
|
|
5
|
+
const {
|
|
6
|
+
client,
|
|
7
|
+
user
|
|
8
|
+
} = await testUtils.createTestUserAndClient()
|
|
9
|
+
const chartKey = testUtils.getChartKey()
|
|
10
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
11
|
+
const event = await client.events.create(chartKey)
|
|
12
|
+
await client.events.channels.add(event.key, 'channelKey1', 'channel 1', '#FFFF98', 1, ['A-1', 'A-2'])
|
|
13
|
+
await client.events.channels.add(event.key, 'channelKey2', 'channel 2', '#FFFF99', 2, ['A-3', 'A-4'])
|
|
14
|
+
|
|
15
|
+
await client.events.channels.addObjects(event.key, 'channelKey1', ['A-3', 'A-4'])
|
|
16
|
+
|
|
17
|
+
const retrievedEvent = await client.events.retrieve(event.key)
|
|
18
|
+
expect(retrievedEvent.channels).toEqual([
|
|
19
|
+
new Channel({
|
|
20
|
+
key: 'channelKey1',
|
|
21
|
+
name: 'channel 1',
|
|
22
|
+
color: '#FFFF98',
|
|
23
|
+
index: 1,
|
|
24
|
+
objects: ['A-1', 'A-2', 'A-3', 'A-4']
|
|
25
|
+
}),
|
|
26
|
+
new Channel({
|
|
27
|
+
key: 'channelKey2',
|
|
28
|
+
name: 'channel 2',
|
|
29
|
+
color: '#FFFF99',
|
|
30
|
+
index: 2,
|
|
31
|
+
objects: []
|
|
32
|
+
})
|
|
33
|
+
])
|
|
34
|
+
})
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
const testUtils = require('../../testUtils')
|
|
2
|
+
const Channel = require('../../../src/Events/Channel')
|
|
3
|
+
test('can remove a channel', async () => {
|
|
4
|
+
const {
|
|
5
|
+
client,
|
|
6
|
+
user
|
|
7
|
+
} = await testUtils.createTestUserAndClient()
|
|
8
|
+
const chartKey = testUtils.getChartKey()
|
|
9
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
10
|
+
const event = await client.events.create(chartKey)
|
|
11
|
+
await client.events.channels.add(event.key, 'channelKey1', 'channel 1', '#FFFF98', 1, ['A-1', 'A-2'])
|
|
12
|
+
await client.events.channels.add(event.key, 'channelKey2', 'channel 2', '#FFFF99', 2, ['A-3', 'A-4'])
|
|
13
|
+
|
|
14
|
+
await client.events.channels.remove(event.key, 'channelKey2')
|
|
15
|
+
|
|
16
|
+
const retrievedEvent = await client.events.retrieve(event.key)
|
|
17
|
+
expect(retrievedEvent.channels).toEqual([
|
|
18
|
+
new Channel({
|
|
19
|
+
key: 'channelKey1',
|
|
20
|
+
name: 'channel 1',
|
|
21
|
+
color: '#FFFF98',
|
|
22
|
+
index: 1,
|
|
23
|
+
objects: ['A-1', 'A-2']
|
|
24
|
+
})
|
|
25
|
+
])
|
|
26
|
+
})
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
const testUtils = require('../../testUtils')
|
|
2
|
+
const Channel = require('../../../src/Events/Channel')
|
|
3
|
+
test('can remove objects from channels', async () => {
|
|
4
|
+
const {
|
|
5
|
+
client,
|
|
6
|
+
user
|
|
7
|
+
} = await testUtils.createTestUserAndClient()
|
|
8
|
+
const chartKey = testUtils.getChartKey()
|
|
9
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
10
|
+
const event = await client.events.create(chartKey)
|
|
11
|
+
await client.events.channels.add(event.key, 'channelKey1', 'channel 1', '#FFFF98', 1, ['A-1', 'A-2', 'A-3', 'A-4'])
|
|
12
|
+
|
|
13
|
+
await client.events.channels.removeObjects(event.key, 'channelKey1', ['A-3', 'A-4'])
|
|
14
|
+
|
|
15
|
+
const retrievedEvent = await client.events.retrieve(event.key)
|
|
16
|
+
expect(retrievedEvent.channels).toEqual([
|
|
17
|
+
new Channel({
|
|
18
|
+
key: 'channelKey1',
|
|
19
|
+
name: 'channel 1',
|
|
20
|
+
color: '#FFFF98',
|
|
21
|
+
index: 1,
|
|
22
|
+
objects: ['A-1', 'A-2']
|
|
23
|
+
})
|
|
24
|
+
])
|
|
25
|
+
})
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
const testUtils = require('
|
|
2
|
-
const Channel = require('
|
|
1
|
+
const testUtils = require('../../testUtils.js')
|
|
2
|
+
const Channel = require('../../../src/Events/Channel.js')
|
|
3
3
|
|
|
4
4
|
test('should assign objects to channels', async () => {
|
|
5
5
|
const {client, user} = await testUtils.createTestUserAndClient()
|
|
6
6
|
const chartKey = testUtils.getChartKey()
|
|
7
7
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
8
8
|
const event = await client.events.create(chartKey)
|
|
9
|
-
await client.events.
|
|
9
|
+
await client.events.channels.replace(event.key, {
|
|
10
10
|
"channelKey1": {name: "channel 1", color: "blue", index: 1},
|
|
11
11
|
"channelKey2": {name: "channel 2", color: "red", index: 2}
|
|
12
12
|
})
|
|
13
13
|
|
|
14
|
-
await client.events.
|
|
14
|
+
await client.events.channels.setObjects(event.key, {
|
|
15
15
|
"channelKey1": ["A-1", "A-2"],
|
|
16
16
|
"channelKey2": ["A-3"]
|
|
17
17
|
})
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const testUtils = require('
|
|
2
|
-
const Channel = require('
|
|
1
|
+
const testUtils = require('../../testUtils.js')
|
|
2
|
+
const Channel = require('../../../src/Events/Channel.js')
|
|
3
3
|
|
|
4
4
|
test('should update channels', async () => {
|
|
5
5
|
const {client} = await testUtils.createTestUserAndClient()
|
|
6
6
|
const chart = await client.charts.create()
|
|
7
7
|
const event = await client.events.create(chart.key)
|
|
8
8
|
|
|
9
|
-
await client.events.
|
|
9
|
+
await client.events.channels.replace(event.key, {
|
|
10
10
|
"channelKey1": {
|
|
11
11
|
"name": "channel 1",
|
|
12
12
|
"color": "#FFAABB",
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
const testUtils = require('../../testUtils')
|
|
2
|
+
const Channel = require('../../../src/Events/Channel')
|
|
3
|
+
|
|
4
|
+
test('update name', async () => {
|
|
5
|
+
const { client, user } = await testUtils.createTestUserAndClient()
|
|
6
|
+
const chartKey = testUtils.getChartKey()
|
|
7
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
8
|
+
const event = await client.events.create(chartKey)
|
|
9
|
+
await client.events.channels.add(event.key, 'channelKey1', 'channel 1', '#FFFF98', 1, ['A-1', 'A-2'])
|
|
10
|
+
|
|
11
|
+
await client.events.channels.update(event.key, 'channelKey1', 'new channel name', undefined, undefined)
|
|
12
|
+
|
|
13
|
+
const retrievedEvent = await client.events.retrieve(event.key)
|
|
14
|
+
expect(retrievedEvent.channels).toEqual([
|
|
15
|
+
new Channel({
|
|
16
|
+
key: 'channelKey1',
|
|
17
|
+
name: 'new channel name',
|
|
18
|
+
color: '#FFFF98',
|
|
19
|
+
index: 1,
|
|
20
|
+
objects: ['A-1', 'A-2']
|
|
21
|
+
})
|
|
22
|
+
])
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
test('update color', async () => {
|
|
26
|
+
const { client, user } = await testUtils.createTestUserAndClient()
|
|
27
|
+
const chartKey = testUtils.getChartKey()
|
|
28
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
29
|
+
const event = await client.events.create(chartKey)
|
|
30
|
+
await client.events.channels.add(event.key, 'channelKey1', 'channel 1', '#FFFF98', 1, ['A-1', 'A-2'])
|
|
31
|
+
|
|
32
|
+
await client.events.channels.update(event.key, 'channelKey1', undefined, 'red', undefined)
|
|
33
|
+
|
|
34
|
+
const retrievedEvent = await client.events.retrieve(event.key)
|
|
35
|
+
expect(retrievedEvent.channels).toEqual([
|
|
36
|
+
new Channel({
|
|
37
|
+
key: 'channelKey1',
|
|
38
|
+
name: 'channel 1',
|
|
39
|
+
color: 'red',
|
|
40
|
+
index: 1,
|
|
41
|
+
objects: ['A-1', 'A-2']
|
|
42
|
+
})
|
|
43
|
+
])
|
|
44
|
+
})
|
|
45
|
+
|
|
46
|
+
test('update objects', async () => {
|
|
47
|
+
const { client, user } = await testUtils.createTestUserAndClient()
|
|
48
|
+
const chartKey = testUtils.getChartKey()
|
|
49
|
+
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
50
|
+
const event = await client.events.create(chartKey)
|
|
51
|
+
await client.events.channels.add(event.key, 'channelKey1', 'channel 1', '#FFFF98', 1, ['A-1', 'A-2'])
|
|
52
|
+
|
|
53
|
+
await client.events.channels.update(event.key, 'channelKey1', undefined, undefined, ['B-1'])
|
|
54
|
+
|
|
55
|
+
const retrievedEvent = await client.events.retrieve(event.key)
|
|
56
|
+
expect(retrievedEvent.channels).toEqual([
|
|
57
|
+
new Channel({
|
|
58
|
+
key: 'channelKey1',
|
|
59
|
+
name: 'channel 1',
|
|
60
|
+
color: '#FFFF98',
|
|
61
|
+
index: 1,
|
|
62
|
+
objects: ['B-1']
|
|
63
|
+
})
|
|
64
|
+
])
|
|
65
|
+
})
|
|
@@ -41,10 +41,10 @@ test('should accept channel keys', async () => {
|
|
|
41
41
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
42
42
|
const event = await client.events.create(chartKey)
|
|
43
43
|
const holdToken = await client.holdTokens.create()
|
|
44
|
-
await client.events.
|
|
44
|
+
await client.events.channels.replace(event.key, {
|
|
45
45
|
channelKey1: { name: 'channel 1', color: '#FFAABB', index: 1 }
|
|
46
46
|
})
|
|
47
|
-
await client.events.
|
|
47
|
+
await client.events.channels.setObjects(event.key, { channelKey1: ['A-1'] })
|
|
48
48
|
await client.events.hold(event.key, ['A-1'], holdToken.holdToken, null, null, null, ['channelKey1'])
|
|
49
49
|
|
|
50
50
|
const objectInfo = await client.events.retrieveObjectInfo(event.key, 'A-1')
|
|
@@ -57,10 +57,10 @@ test('should accept ignoreChannels', async () => {
|
|
|
57
57
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
58
58
|
const event = await client.events.create(chartKey)
|
|
59
59
|
const holdToken = await client.holdTokens.create()
|
|
60
|
-
await client.events.
|
|
60
|
+
await client.events.channels.replace(event.key, {
|
|
61
61
|
channelKey1: { name: 'channel 1', color: '#FFAABB', index: 1 }
|
|
62
62
|
})
|
|
63
|
-
await client.events.
|
|
63
|
+
await client.events.channels.setObjects(event.key, { channelKey1: ['A-1'] })
|
|
64
64
|
|
|
65
65
|
await client.events.hold(event.key, ['A-1'], holdToken.holdToken, null, null, true)
|
|
66
66
|
|