Skip to content

Commit eb9d6eb

Browse files
authored
Merge pull request #5 from SecJS/fix/len-where-relations-tests
fix: Where and relations tests
2 parents 51486d8 + cfa634c commit eb9d6eb

7 files changed

Lines changed: 49 additions & 42 deletions

File tree

app/templates/nestjsMongoose/E2E/__name__/index.spec.ts.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('\n[E2E] <%= namePascal %> 🗒', () => {
3434
})
3535

3636
it('should throw an error when trying to filter by values not authorized in the model <%= nameCamel %>', async () => {
37-
const status = 400
37+
const status = 422
3838
const method = 'GET'
3939
const path = `/<%= namePluralCamel %>?*testetwoe=hello`
4040

@@ -45,17 +45,18 @@ describe('\n[E2E] <%= namePascal %> 🗒', () => {
4545
expect(body.method).toBe(method)
4646
expect(body.status).toBe(status)
4747
expect(body.error).toEqual({
48-
name: 'REPOSITORY_WHERE_ERROR',
48+
isSecJsException: true,
49+
name: 'UnprocessableEntityException',
4950
message: {
50-
error: 'Bad Request',
51+
error: 'Unprocessable Entity Error',
5152
message: 'It is not possible to filter by testetwoe',
5253
statusCode: status,
5354
},
5455
})
5556
})
5657

5758
it('should throw an error when trying to include relations not authorized in the model <%= nameCamel %>', async () => {
58-
const status = 400
59+
const status = 422
5960
const method = 'GET'
6061
const path = `/<%= namePluralCamel %>?_testetwoe=[]`
6162

@@ -66,9 +67,10 @@ describe('\n[E2E] <%= namePascal %> 🗒', () => {
6667
expect(body.method).toBe(method)
6768
expect(body.status).toBe(status)
6869
expect(body.error).toEqual({
69-
name: 'REPOSITORY_RELATION_ERROR',
70+
isSecJsException: true,
71+
name: 'UnprocessableEntityException',
7072
message: {
71-
error: 'Bad Request',
73+
error: 'Unprocessable Entity Error',
7274
message: 'It is not possible to include testetwoe relation',
7375
statusCode: status,
7476
},

app/templates/nestjsMongoose/E2E/__name__/show.spec.ts.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('\n[E2E] <%= namePascal %> 🔍', () => {
4444
})
4545

4646
it('should throw an error when trying to filter by values not authorized in the model <%= nameCamel %>', async () => {
47-
const status = 400
47+
const status = 422
4848
const method = 'GET'
4949
const path = `/<%= namePluralCamel %>/507f1f77bcf86cd799439011?*testetwoe=hello`
5050

@@ -55,17 +55,18 @@ describe('\n[E2E] <%= namePascal %> 🔍', () => {
5555
expect(body.method).toBe(method)
5656
expect(body.status).toBe(status)
5757
expect(body.error).toEqual({
58-
name: 'REPOSITORY_WHERE_ERROR',
58+
isSecJsException: true,
59+
name: 'UnprocessableEntityException',
5960
message: {
60-
error: 'Bad Request',
61+
error: 'Unprocessable Entity Error',
6162
message: 'It is not possible to filter by testetwoe',
6263
statusCode: status,
6364
},
6465
})
6566
})
6667

6768
it('should throw an error when trying to include relations not authorized in the model <%= nameCamel %>', async () => {
68-
const status = 400
69+
const status = 422
6970
const method = 'GET'
7071
const path = `/<%= namePluralCamel %>/507f1f77bcf86cd799439011?_testetwoe=[]`
7172

@@ -76,9 +77,10 @@ describe('\n[E2E] <%= namePascal %> 🔍', () => {
7677
expect(body.method).toBe(method)
7778
expect(body.status).toBe(status)
7879
expect(body.error).toEqual({
79-
name: 'REPOSITORY_RELATION_ERROR',
80+
isSecJsException: true,
81+
name: 'UnprocessableEntityException',
8082
message: {
81-
error: 'Bad Request',
83+
error: 'Unprocessable Entity Error',
8284
message: 'It is not possible to include testetwoe relation',
8385
statusCode: status,
8486
},
@@ -106,4 +108,3 @@ afterEach(async () => {
106108
await database.truncateCache()
107109
await app.closeApp()
108110
})
109-

app/templates/nestjsPrismaOrm/E2E/__name__/index.spec.ts.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('\n[E2E] <%= namePascal %> 🗒', () => {
3434
})
3535

3636
it('should throw an error when trying to filter by values not authorized in the model <%= nameCamel %>', async () => {
37-
const status = 400
37+
const status = 422
3838
const method = 'GET'
3939
const path = `/<%= namePluralCamel %>?*testetwoe=hello`
4040

@@ -45,17 +45,18 @@ describe('\n[E2E] <%= namePascal %> 🗒', () => {
4545
expect(body.method).toBe(method)
4646
expect(body.status).toBe(status)
4747
expect(body.error).toEqual({
48-
name: 'REPOSITORY_WHERE_ERROR',
48+
isSecJsException: true,
49+
name: 'UnprocessableEntityException',
4950
message: {
50-
error: 'Bad Request',
51+
error: 'Unprocessable Entity Error',
5152
message: 'It is not possible to filter by testetwoe',
5253
statusCode: status,
5354
},
5455
})
5556
})
5657

5758
it('should throw an error when trying to include relations not authorized in the model <%= nameCamel %>', async () => {
58-
const status = 400
59+
const status = 422
5960
const method = 'GET'
6061
const path = `/<%= namePluralCamel %>?_testetwoe=[]`
6162

@@ -66,9 +67,10 @@ describe('\n[E2E] <%= namePascal %> 🗒', () => {
6667
expect(body.method).toBe(method)
6768
expect(body.status).toBe(status)
6869
expect(body.error).toEqual({
69-
name: 'REPOSITORY_RELATION_ERROR',
70+
isSecJsException: true,
71+
name: 'UnprocessableEntityException',
7072
message: {
71-
error: 'Bad Request',
73+
error: 'Unprocessable Entity Error',
7274
message: 'It is not possible to include testetwoe relation',
7375
statusCode: status,
7476
},
@@ -96,4 +98,3 @@ afterEach(async () => {
9698
await database.truncateCache()
9799
await app.closeApp()
98100
})
99-

app/templates/nestjsPrismaOrm/E2E/__name__/show.spec.ts.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('\n[E2E] <%= namePascal %> 🔍', () => {
4444
})
4545

4646
it('should throw an error when trying to filter by values not authorized in the model <%= nameCamel %>', async () => {
47-
const status = 400
47+
const status = 422
4848
const method = 'GET'
4949
const path = `/<%= namePluralCamel %>/507f1f77bcf86cd799439011?*testetwoe=hello`
5050

@@ -55,17 +55,18 @@ describe('\n[E2E] <%= namePascal %> 🔍', () => {
5555
expect(body.method).toBe(method)
5656
expect(body.status).toBe(status)
5757
expect(body.error).toEqual({
58-
name: 'REPOSITORY_WHERE_ERROR',
58+
isSecJsException: true,
59+
name: 'UnprocessableEntityException',
5960
message: {
60-
error: 'Bad Request',
61+
error: 'Unprocessable Entity Error',
6162
message: 'It is not possible to filter by testetwoe',
6263
statusCode: status,
6364
},
6465
})
6566
})
6667

6768
it('should throw an error when trying to include relations not authorized in the model <%= nameCamel %>', async () => {
68-
const status = 400
69+
const status = 422
6970
const method = 'GET'
7071
const path = `/<%= namePluralCamel %>/507f1f77bcf86cd799439011?_testetwoe=[]`
7172

@@ -76,9 +77,10 @@ describe('\n[E2E] <%= namePascal %> 🔍', () => {
7677
expect(body.method).toBe(method)
7778
expect(body.status).toBe(status)
7879
expect(body.error).toEqual({
79-
name: 'REPOSITORY_RELATION_ERROR',
80+
isSecJsException: true,
81+
name: 'UnprocessableEntityException',
8082
message: {
81-
error: 'Bad Request',
83+
error: 'Unprocessable Entity Error',
8284
message: 'It is not possible to include testetwoe relation',
8385
statusCode: status,
8486
},
@@ -106,4 +108,3 @@ afterEach(async () => {
106108
await database.truncateCache()
107109
await app.closeApp()
108110
})
109-

app/templates/nestjsTypeOrm/E2E/__name__/index.spec.ts.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ describe('\n[E2E] <%= namePascal %> 🗒', () => {
3434
})
3535

3636
it('should throw an error when trying to filter by values not authorized in the model <%= nameCamel %>', async () => {
37-
const status = 400
37+
const status = 422
3838
const method = 'GET'
3939
const path = `/<%= namePluralCamel %>?*testetwoe=hello`
4040

@@ -45,17 +45,18 @@ describe('\n[E2E] <%= namePascal %> 🗒', () => {
4545
expect(body.method).toBe(method)
4646
expect(body.status).toBe(status)
4747
expect(body.error).toEqual({
48-
name: 'REPOSITORY_WHERE_ERROR',
48+
isSecJsException: true,
49+
name: 'UnprocessableEntityException',
4950
message: {
50-
error: 'Bad Request',
51+
error: 'Unprocessable Entity Error',
5152
message: 'It is not possible to filter by testetwoe',
5253
statusCode: status,
5354
},
5455
})
5556
})
5657

5758
it('should throw an error when trying to include relations not authorized in the model <%= nameCamel %>', async () => {
58-
const status = 400
59+
const status = 422
5960
const method = 'GET'
6061
const path = `/<%= namePluralCamel %>?_testetwoe=[]`
6162

@@ -66,9 +67,10 @@ describe('\n[E2E] <%= namePascal %> 🗒', () => {
6667
expect(body.method).toBe(method)
6768
expect(body.status).toBe(status)
6869
expect(body.error).toEqual({
69-
name: 'REPOSITORY_RELATION_ERROR',
70+
isSecJsException: true,
71+
name: 'UnprocessableEntityException',
7072
message: {
71-
error: 'Bad Request',
73+
error: 'Unprocessable Entity Error',
7274
message: 'It is not possible to include testetwoe relation',
7375
statusCode: status,
7476
},
@@ -96,4 +98,3 @@ afterEach(async () => {
9698
await database.truncateCache()
9799
await app.closeApp()
98100
})
99-

app/templates/nestjsTypeOrm/E2E/__name__/show.spec.ts.txt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ describe('\n[E2E] <%= namePascal %> 🔍', () => {
4444
})
4545

4646
it('should throw an error when trying to filter by values not authorized in the model <%= nameCamel %>', async () => {
47-
const status = 400
47+
const status = 422
4848
const method = 'GET'
4949
const path = `/<%= namePluralCamel %>/507f1f77bcf86cd799439011?*testetwoe=hello`
5050

@@ -55,17 +55,18 @@ describe('\n[E2E] <%= namePascal %> 🔍', () => {
5555
expect(body.method).toBe(method)
5656
expect(body.status).toBe(status)
5757
expect(body.error).toEqual({
58-
name: 'REPOSITORY_WHERE_ERROR',
58+
isSecJsException: true,
59+
name: 'UnprocessableEntityException',
5960
message: {
60-
error: 'Bad Request',
61+
error: 'Unprocessable Entity Error',
6162
message: 'It is not possible to filter by testetwoe',
6263
statusCode: status,
6364
},
6465
})
6566
})
6667

6768
it('should throw an error when trying to include relations not authorized in the model <%= nameCamel %>', async () => {
68-
const status = 400
69+
const status = 422
6970
const method = 'GET'
7071
const path = `/<%= namePluralCamel %>/507f1f77bcf86cd799439011?_testetwoe=[]`
7172

@@ -76,9 +77,10 @@ describe('\n[E2E] <%= namePascal %> 🔍', () => {
7677
expect(body.method).toBe(method)
7778
expect(body.status).toBe(status)
7879
expect(body.error).toEqual({
79-
name: 'REPOSITORY_RELATION_ERROR',
80+
isSecJsException: true,
81+
name: 'UnprocessableEntityException',
8082
message: {
81-
error: 'Bad Request',
83+
error: 'Unprocessable Entity Error',
8284
message: 'It is not possible to include testetwoe relation',
8385
statusCode: status,
8486
},
@@ -106,4 +108,3 @@ afterEach(async () => {
106108
await database.truncateCache()
107109
await app.closeApp()
108110
})
109-

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "generator-secjs",
3-
"version": "1.1.7",
3+
"version": "1.1.8",
44
"description": "🧬 Generator for any NodeJS Project or Framework",
55
"main": "app/index.js",
66
"scripts": {

0 commit comments

Comments
 (0)