Skip to content

Commit 8b9303f

Browse files
refactor error messages in deletion, publishing, and unpublishing tests for clarity
1 parent 894314b commit 8b9303f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

test/deletion.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ describe('delete', () => {
2626

2727
return connect(config).then((mongodb) => {
2828
mongo = mongodb
29-
mongoClient = new Mongodb(mongodb, connector, config.contentStore)
29+
mongoClient = new Mongodb(mongodb, connector, config.contentStore, config)
3030
db = mongoClient
3131
})
3232
.catch(console.error)
@@ -154,7 +154,7 @@ describe('delete', () => {
154154
test('delete entry with error', () => {
155155

156156
return db.delete().catch((error) => {
157-
expect(error.message).toEqual("Cannot read property '_content_type_uid' of undefined")
157+
expect(error.message).toEqual("Cannot read properties of undefined (reading \'_content_type_uid\')")
158158
})
159159
})
160160
})

test/publishing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('publish', () => {
2525

2626
return connect(config).then((mongodb) => {
2727
mongo = mongodb
28-
mongoClient = new Mongodb(mongodb, connector, config.contentStore)
28+
mongoClient = new Mongodb(mongodb, connector, config.contentStore, config)
2929
db = mongoClient
3030
})
3131
.catch(console.error)
@@ -64,7 +64,7 @@ describe('publish', () => {
6464
describe('publish should throw an error', () => {
6565
test('publish entry successfully', () => {
6666
return db.publish().catch((error) => {
67-
expect(error.message).toEqual('Cannot read property \'_content_type_uid\' of undefined')
67+
expect(error.message).toContain('Cannot read properties of undefined (reading \'_content_type_uid\')')
6868
})
6969
})
7070
})

test/unpublishing.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ describe('unpublish', () => {
2525

2626
return connect(config).then((mongodb) => {
2727
mongo = mongodb
28-
mongoClient = new Mongodb(mongodb, connector, config.contentStore)
28+
mongoClient = new Mongodb(mongodb, connector, config.contentStore, config)
2929
db = mongoClient
3030
}).catch(console.error)
3131
})
@@ -95,7 +95,7 @@ describe('unpublish', () => {
9595
return db.unpublish().then((result) => {
9696
expect(result).toBeUndefined()
9797
}).catch((error) => {
98-
expect(error.message).toEqual("Cannot read property '_content_type_uid' of undefined")
98+
expect(error.message).toEqual("Cannot read properties of undefined (reading \'_content_type_uid\')")
9999
})
100100
})
101101
})

0 commit comments

Comments
 (0)