add html sanitization test
This commit is contained in:
@@ -223,6 +223,27 @@ describe('Events', () => {
|
||||
expect(response.body.title).toBe('test title 4')
|
||||
expect(response.body.tags[0]).toBe('test tag')
|
||||
})
|
||||
|
||||
|
||||
test('should sanitize htlm in description', async () => {
|
||||
const event = {
|
||||
title: 'test title',
|
||||
place_id: places[0],
|
||||
start_datetime: dayjs().unix() + 1000,
|
||||
tags: ['test tags'],
|
||||
description: `<p wrong-attr="" onclick="alert('test');">inside paragraph</p><a href="https://test.com/?query=true&fbclid=facebook_id">link with fb reference</a>`
|
||||
}
|
||||
|
||||
|
||||
const response = await request(app).post('/api/event')
|
||||
.send(event)
|
||||
.expect(200)
|
||||
.expect('Content-Type', /json/)
|
||||
|
||||
expect(response.body.description).toBe(`<p>inside paragraph</p><a href="https://test.com/?query=true">link with fb reference</a>`)
|
||||
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
let event = {}
|
||||
|
||||
Reference in New Issue
Block a user