seatsio 67.8.0 → 69.1.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 +5 -5
- package/src/Charts/Category.js +4 -0
- package/src/Charts/ChartObjectInfo.js +1 -0
- package/src/Events/Channels.js +52 -0
- package/src/Events/Event.js +19 -18
- package/src/Events/EventObjectInfo.js +1 -0
- package/src/Events/Events.js +2 -8
- package/src/utilities/reportUtility.js +3 -3
- package/tests/chartReports/chartReport.test.js +12 -0
- package/tests/eventReports/eventReport.test.js +20 -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/createEvent.test.js +1 -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/events/retrieveEvent.test.js +2 -1
- package/tests/testUtils.js +33 -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.1.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",
|
|
@@ -14,13 +14,13 @@
|
|
|
14
14
|
"url": "https://github.com/seatsio/seatsio-js"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"axios": "0.
|
|
17
|
+
"axios": "0.27.2"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
20
|
"browserify": "latest",
|
|
21
21
|
"eslint": "7.32.0",
|
|
22
22
|
"eslint-config-standard": "16.0.3",
|
|
23
|
-
"eslint-plugin-import": "2.
|
|
23
|
+
"eslint-plugin-import": "2.26.0",
|
|
24
24
|
"eslint-plugin-node": "11.1.0",
|
|
25
25
|
"eslint-plugin-promise": "6.0.0",
|
|
26
26
|
"eslint-plugin-standard": "5.0.0",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"gulp-tap": "latest",
|
|
31
31
|
"gulp-uglify": "latest",
|
|
32
32
|
"gulp-uglify-es": "latest",
|
|
33
|
-
"jest": "
|
|
34
|
-
"jest-cli": "
|
|
33
|
+
"jest": "28.1.0",
|
|
34
|
+
"jest-cli": "28.1.0",
|
|
35
35
|
"uuid": "8.3.2"
|
|
36
36
|
}
|
|
37
37
|
}
|
package/src/Charts/Category.js
CHANGED
|
@@ -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/Event.js
CHANGED
|
@@ -1,27 +1,28 @@
|
|
|
1
1
|
const ForSaleConfig = require('./ForSaleConfig.js')
|
|
2
2
|
const Channel = require('./Channel.js')
|
|
3
|
+
const Category = require('../Charts/Category')
|
|
3
4
|
|
|
4
5
|
class Event {
|
|
5
6
|
/**
|
|
6
|
-
* @param {object}
|
|
7
|
+
* @param {object} json
|
|
7
8
|
*/
|
|
8
|
-
constructor (
|
|
9
|
-
this.id =
|
|
10
|
-
this.key =
|
|
11
|
-
this.tableBookingConfig =
|
|
12
|
-
this.supportsBestAvailable =
|
|
13
|
-
this.forSaleConfig =
|
|
14
|
-
this.chartKey =
|
|
15
|
-
this.createdOn =
|
|
16
|
-
this.updatedOn =
|
|
17
|
-
this.channels =
|
|
18
|
-
this.socialDistancingRulesetKey =
|
|
19
|
-
this.topLevelSeasonKey =
|
|
20
|
-
this.isTopLevelSeason =
|
|
21
|
-
this.isPartialSeason =
|
|
22
|
-
this.isEventInSeason =
|
|
23
|
-
this.objectCategories =
|
|
24
|
-
this.categories =
|
|
9
|
+
constructor (json) {
|
|
10
|
+
this.id = json.id
|
|
11
|
+
this.key = json.key
|
|
12
|
+
this.tableBookingConfig = json.tableBookingConfig
|
|
13
|
+
this.supportsBestAvailable = json.supportsBestAvailable
|
|
14
|
+
this.forSaleConfig = json.forSaleConfig ? new ForSaleConfig(json.forSaleConfig.forSale, json.forSaleConfig.objects, json.forSaleConfig.categories) : null
|
|
15
|
+
this.chartKey = json.chartKey
|
|
16
|
+
this.createdOn = json.createdOn ? new Date(json.createdOn) : null
|
|
17
|
+
this.updatedOn = json.updatedOn ? new Date(json.updatedOn) : null
|
|
18
|
+
this.channels = json.channels ? json.channels.map(c => new Channel(c)) : null
|
|
19
|
+
this.socialDistancingRulesetKey = json.socialDistancingRulesetKey
|
|
20
|
+
this.topLevelSeasonKey = json.topLevelSeasonKey
|
|
21
|
+
this.isTopLevelSeason = json.isTopLevelSeason
|
|
22
|
+
this.isPartialSeason = json.isPartialSeason
|
|
23
|
+
this.isEventInSeason = json.isEventInSeason
|
|
24
|
+
this.objectCategories = json.objectCategories
|
|
25
|
+
this.categories = json.categories ? json.categories.map(c => Category.fromJson(c)) : null
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
isSeason () {
|
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
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
const ChartObjectInfo = require('../Charts/ChartObjectInfo.js')
|
|
2
|
-
const
|
|
2
|
+
const EventObjectInfo = require('../Events/EventObjectInfo.js')
|
|
3
3
|
|
|
4
4
|
module.exports = {
|
|
5
5
|
|
|
6
6
|
createChangeObjectStatusDetails (data) {
|
|
7
7
|
const objectDetails = {}
|
|
8
8
|
for (const key in data) {
|
|
9
|
-
objectDetails[key] = new
|
|
9
|
+
objectDetails[key] = new EventObjectInfo(data[key])
|
|
10
10
|
}
|
|
11
11
|
return objectDetails
|
|
12
12
|
},
|
|
@@ -18,7 +18,7 @@ module.exports = {
|
|
|
18
18
|
createEventReport (reportsData) {
|
|
19
19
|
const reportObjects = {}
|
|
20
20
|
for (const key of Object.keys(reportsData)) {
|
|
21
|
-
reportObjects[key] = reportsData[key].map(data => new
|
|
21
|
+
reportObjects[key] = reportsData[key].map(data => new EventObjectInfo(data))
|
|
22
22
|
}
|
|
23
23
|
return reportObjects
|
|
24
24
|
},
|
|
@@ -36,6 +36,18 @@ test('chart report properties for GA', async () => {
|
|
|
36
36
|
expect(reportItem.bookAsAWhole).toBe(false)
|
|
37
37
|
})
|
|
38
38
|
|
|
39
|
+
test('chart report properties for table', async () => {
|
|
40
|
+
const { client, user } = await testUtils.createTestUserAndClient()
|
|
41
|
+
const chartKey = testUtils.getChartKey()
|
|
42
|
+
await testUtils.createTestChartWithTables(chartKey, user.secretKey)
|
|
43
|
+
|
|
44
|
+
const report = await client.chartReports.byLabel(chartKey, 'true')
|
|
45
|
+
|
|
46
|
+
const reportItem = report.T1[0]
|
|
47
|
+
expect(reportItem.numSeats).toBe(6)
|
|
48
|
+
expect(reportItem.bookAsAWhole).toBe(false)
|
|
49
|
+
})
|
|
50
|
+
|
|
39
51
|
test('get report byLabel', async () => {
|
|
40
52
|
const { client, user } = await testUtils.createTestUserAndClient()
|
|
41
53
|
const chartKey = testUtils.getChartKey()
|
|
@@ -2,6 +2,7 @@ const testUtils = require('../testUtils.js')
|
|
|
2
2
|
const EventObjectInfo = require('../../src/Events/EventObjectInfo.js')
|
|
3
3
|
const ObjectProperties = require('../../src/Events/ObjectProperties.js')
|
|
4
4
|
const { IDs } = require('../../src/Common/IDs')
|
|
5
|
+
const { TableBookingconfig } = require('../../index')
|
|
5
6
|
|
|
6
7
|
test('report properties', async () => {
|
|
7
8
|
const { client, user } = await testUtils.createTestUserAndClient()
|
|
@@ -10,10 +11,10 @@ test('report properties', async () => {
|
|
|
10
11
|
const event = await client.events.create(chartKey)
|
|
11
12
|
const extraData = { foo: 'bar' }
|
|
12
13
|
await client.events.book(event.key, (new ObjectProperties('A-1')).setTicketType('ticketType1').setExtraData(extraData), null, 'order1')
|
|
13
|
-
await client.events.
|
|
14
|
+
await client.events.channels.replace(event.key, {
|
|
14
15
|
channel1: { name: 'channel 1', color: 'blue', index: 1 }
|
|
15
16
|
})
|
|
16
|
-
await client.events.
|
|
17
|
+
await client.events.channels.setObjects(event.key, { channel1: ['A-1'] })
|
|
17
18
|
|
|
18
19
|
const report = await client.eventReports.byLabel(event.key)
|
|
19
20
|
|
|
@@ -82,6 +83,19 @@ test('report properties for GA', async () => {
|
|
|
82
83
|
expect(reportItem.bookAsAWhole).toBe(false)
|
|
83
84
|
})
|
|
84
85
|
|
|
86
|
+
test('report properties for table', async () => {
|
|
87
|
+
const { client, user } = await testUtils.createTestUserAndClient()
|
|
88
|
+
const chartKey = testUtils.getChartKey()
|
|
89
|
+
await testUtils.createTestChartWithTables(chartKey, user.secretKey)
|
|
90
|
+
const event = await client.events.create(chartKey, null, TableBookingconfig.allByTable())
|
|
91
|
+
|
|
92
|
+
const report = await client.eventReports.byLabel(event.key)
|
|
93
|
+
|
|
94
|
+
const reportItem = report.T1[0]
|
|
95
|
+
expect(reportItem.numSeats).toBe(6)
|
|
96
|
+
expect(reportItem.bookAsAWhole).toBe(false)
|
|
97
|
+
})
|
|
98
|
+
|
|
85
99
|
test('report with object status', async () => {
|
|
86
100
|
const { client, user } = await testUtils.createTestUserAndClient()
|
|
87
101
|
const chartKey = testUtils.getChartKey()
|
|
@@ -316,10 +330,10 @@ test('report by channel', async () => {
|
|
|
316
330
|
const chartKey = testUtils.getChartKey()
|
|
317
331
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
318
332
|
const event = await client.events.create(chartKey)
|
|
319
|
-
await client.events.
|
|
333
|
+
await client.events.channels.replace(event.key, {
|
|
320
334
|
channel1: { name: 'channel 1', color: 'blue', index: 1 }
|
|
321
335
|
})
|
|
322
|
-
await client.events.
|
|
336
|
+
await client.events.channels.setObjects(event.key, { channel1: ['A-1', 'A-2'] })
|
|
323
337
|
|
|
324
338
|
const report = await client.eventReports.byChannel(event.key)
|
|
325
339
|
|
|
@@ -332,10 +346,10 @@ test('report by specific channel', async () => {
|
|
|
332
346
|
const chartKey = testUtils.getChartKey()
|
|
333
347
|
await testUtils.createTestChart(chartKey, user.secretKey)
|
|
334
348
|
const event = await client.events.create(chartKey)
|
|
335
|
-
await client.events.
|
|
349
|
+
await client.events.channels.replace(event.key, {
|
|
336
350
|
channel1: { name: 'channel 1', color: 'blue', index: 1 }
|
|
337
351
|
})
|
|
338
|
-
await client.events.
|
|
352
|
+
await client.events.channels.setObjects(event.key, { channel1: ['A-1', 'A-2'] })
|
|
339
353
|
|
|
340
354
|
const report = await client.eventReports.byChannel(event.key, 'channel1')
|
|
341
355
|
|
|
@@ -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",
|