@next-k8s/tickets 1.0.12 → 1.0.16
Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,38 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [1.0.16](https://github.com/mathiscode/next-k8s-boilerplate/compare/@next-k8s/tickets@1.0.15...@next-k8s/tickets@1.0.16) (2022-07-07)
|
7
|
+
|
8
|
+
**Note:** Version bump only for package @next-k8s/tickets
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
|
14
|
+
## [1.0.15](https://github.com/mathiscode/next-k8s-boilerplate/compare/@next-k8s/tickets@1.0.14...@next-k8s/tickets@1.0.15) (2022-07-07)
|
15
|
+
|
16
|
+
**Note:** Version bump only for package @next-k8s/tickets
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
|
22
|
+
## [1.0.14](https://github.com/mathiscode/next-k8s-boilerplate/compare/@next-k8s/tickets@1.0.13...@next-k8s/tickets@1.0.14) (2022-07-07)
|
23
|
+
|
24
|
+
**Note:** Version bump only for package @next-k8s/tickets
|
25
|
+
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
|
30
|
+
## [1.0.13](https://github.com/mathiscode/next-k8s-boilerplate/compare/@next-k8s/tickets@1.0.12...@next-k8s/tickets@1.0.13) (2022-07-07)
|
31
|
+
|
32
|
+
**Note:** Version bump only for package @next-k8s/tickets
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
|
37
|
+
|
6
38
|
## [1.0.12](https://github.com/mathiscode/next-k8s-boilerplate/compare/@next-k8s/tickets@1.0.11...@next-k8s/tickets@1.0.12) (2022-07-07)
|
7
39
|
|
8
40
|
**Note:** Version bump only for package @next-k8s/tickets
|
package/LICENSE.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2022 Jay Mathis <code@mathis.network>
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@next-k8s/tickets",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.16",
|
4
4
|
"main": "index.js",
|
5
5
|
"license": "MIT",
|
6
6
|
"scripts": {
|
@@ -25,7 +25,7 @@
|
|
25
25
|
]
|
26
26
|
},
|
27
27
|
"dependencies": {
|
28
|
-
"@next-k8s/common": "^0.1.
|
28
|
+
"@next-k8s/common": "^0.1.30",
|
29
29
|
"@types/cookie-session": "^2.0.44",
|
30
30
|
"@types/express": "^4.17.13",
|
31
31
|
"@types/jsonwebtoken": "^8.5.8",
|
@@ -51,5 +51,5 @@
|
|
51
51
|
"supertest": "^6.2.3",
|
52
52
|
"ts-jest": "^28.0.4"
|
53
53
|
},
|
54
|
-
"gitHead": "
|
54
|
+
"gitHead": "20a9347e420d886b4e16ecd88afabb7b5768f2c0"
|
55
55
|
}
|
@@ -17,7 +17,7 @@ describe('[Create New Ticket] Route: /api/tickets', () => {
|
|
17
17
|
})
|
18
18
|
|
19
19
|
it('should not get UnauthorizedError if authenticated', async () => {
|
20
|
-
const cookie = await getTokenCookie()
|
20
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
21
21
|
const response = await request(app)
|
22
22
|
.post('/api/tickets')
|
23
23
|
.set('Cookie', [cookie])
|
@@ -27,7 +27,7 @@ describe('[Create New Ticket] Route: /api/tickets', () => {
|
|
27
27
|
})
|
28
28
|
|
29
29
|
it('should throw error if new ticket has invalid title', async () => {
|
30
|
-
const cookie = await getTokenCookie()
|
30
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
31
31
|
await request(app)
|
32
32
|
.post('/api/tickets')
|
33
33
|
.set('Cookie', [cookie])
|
@@ -36,7 +36,7 @@ describe('[Create New Ticket] Route: /api/tickets', () => {
|
|
36
36
|
})
|
37
37
|
|
38
38
|
it('should throw error if new ticket has invalid price', async () => {
|
39
|
-
const cookie = await getTokenCookie()
|
39
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
40
40
|
await request(app)
|
41
41
|
.post('/api/tickets')
|
42
42
|
.set('Cookie', [cookie])
|
@@ -52,7 +52,7 @@ describe('[Create New Ticket] Route: /api/tickets', () => {
|
|
52
52
|
|
53
53
|
it('should create a new ticket', async () => {
|
54
54
|
let tickets = await Ticket.find({})
|
55
|
-
const cookie = await getTokenCookie()
|
55
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
56
56
|
|
57
57
|
await request(app)
|
58
58
|
.post('/api/tickets')
|
@@ -69,7 +69,7 @@ describe('[Create New Ticket] Route: /api/tickets', () => {
|
|
69
69
|
})
|
70
70
|
|
71
71
|
it('should publish a ticket:created event', async () => {
|
72
|
-
const cookie = await getTokenCookie()
|
72
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
73
73
|
await createTicket(app, cookie)
|
74
74
|
expect(natsClient.client.publish).toHaveBeenCalled()
|
75
75
|
})
|
@@ -4,7 +4,7 @@ import { createTicket, getTokenCookie } from '../../test/utils'
|
|
4
4
|
|
5
5
|
describe('[List Tickets] Route: /api/tickets', () => {
|
6
6
|
it('should return a list of tickets', async () => {
|
7
|
-
const cookie = await getTokenCookie()
|
7
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
8
8
|
await createTicket(app, cookie)
|
9
9
|
await createTicket(app, cookie, 'Test Event 2', 40000)
|
10
10
|
const list = await request(app)
|
@@ -20,7 +20,7 @@ describe('[Get Ticket] Route: /api/tickets/:id', () => {
|
|
20
20
|
})
|
21
21
|
|
22
22
|
it('should return the fetched ticket', async () => {
|
23
|
-
const cookie = await getTokenCookie()
|
23
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
24
24
|
const response = await createTicket(app, cookie)
|
25
25
|
|
26
26
|
const ticket = await request(app)
|
@@ -8,7 +8,7 @@ import natsClient from '../../nats-client'
|
|
8
8
|
describe('[Update Ticket] Route: /api/tickets/:id', () => {
|
9
9
|
it('should throw a NotFoundError if the ticket does not exist', async () => {
|
10
10
|
const id = new mongoose.Types.ObjectId().toHexString()
|
11
|
-
const cookie = await getTokenCookie()
|
11
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
12
12
|
|
13
13
|
await request(app)
|
14
14
|
.put(`/api/tickets/${id}`)
|
@@ -18,7 +18,7 @@ describe('[Update Ticket] Route: /api/tickets/:id', () => {
|
|
18
18
|
})
|
19
19
|
|
20
20
|
it('should throw an UnauthorizedError if not authenticated', async () => {
|
21
|
-
const cookie = await getTokenCookie()
|
21
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
22
22
|
|
23
23
|
const response = await request(app)
|
24
24
|
.post(`/api/tickets`)
|
@@ -33,7 +33,7 @@ describe('[Update Ticket] Route: /api/tickets/:id', () => {
|
|
33
33
|
})
|
34
34
|
|
35
35
|
it('should throw an UnauthorizedError if user does not own the ticket', async () => {
|
36
|
-
const cookie = await getTokenCookie()
|
36
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
37
37
|
|
38
38
|
const response = await request(app)
|
39
39
|
.post(`/api/tickets`)
|
@@ -41,7 +41,7 @@ describe('[Update Ticket] Route: /api/tickets/:id', () => {
|
|
41
41
|
.send({ title: 'Test Event', price: 20000 })
|
42
42
|
.expect(201)
|
43
43
|
|
44
|
-
const newCookie = await getTokenCookie()
|
44
|
+
const newCookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
45
45
|
|
46
46
|
await request(app)
|
47
47
|
.put(`/api/tickets/${response.body.ticket.id}`)
|
@@ -51,7 +51,7 @@ describe('[Update Ticket] Route: /api/tickets/:id', () => {
|
|
51
51
|
})
|
52
52
|
|
53
53
|
it('should throw a BadRequestError if an invalid ticket is provided', async () => {
|
54
|
-
const cookie = await getTokenCookie()
|
54
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
55
55
|
|
56
56
|
await request(app)
|
57
57
|
.put(`/api/tickets/notarealid`)
|
@@ -61,7 +61,7 @@ describe('[Update Ticket] Route: /api/tickets/:id', () => {
|
|
61
61
|
})
|
62
62
|
|
63
63
|
it('should throw an error on invalid ticket data', async () => {
|
64
|
-
const cookie = await getTokenCookie()
|
64
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
65
65
|
const response = await createTicket(app, cookie)
|
66
66
|
|
67
67
|
await request(app)
|
@@ -78,7 +78,7 @@ describe('[Update Ticket] Route: /api/tickets/:id', () => {
|
|
78
78
|
})
|
79
79
|
|
80
80
|
it('should update a ticket', async () => {
|
81
|
-
const cookie = await getTokenCookie()
|
81
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
82
82
|
const response = await createTicket(app, cookie)
|
83
83
|
|
84
84
|
const updated = await request(app)
|
@@ -94,7 +94,7 @@ describe('[Update Ticket] Route: /api/tickets/:id', () => {
|
|
94
94
|
})
|
95
95
|
|
96
96
|
it('should publish a ticket:updated event', async () => {
|
97
|
-
const cookie = await getTokenCookie()
|
97
|
+
const cookie = await getTokenCookie({ id: new mongoose.Types.ObjectId().toHexString() })
|
98
98
|
await createTicket(app, cookie)
|
99
99
|
expect(natsClient.client.publish).toHaveBeenCalled()
|
100
100
|
})
|