fix: Long search term causes server error writing query to db (#2237)
closes #2234
This commit is contained in:
@ -984,6 +984,21 @@ describe("#documents.search", () => {
|
||||
expect(body.data.length).toEqual(0);
|
||||
});
|
||||
|
||||
it("should not error when search term is very long", async () => {
|
||||
const { user } = await seed();
|
||||
const res = await server.post("/api/documents.search", {
|
||||
body: {
|
||||
token: user.getJwtToken(),
|
||||
query:
|
||||
"much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much much longer search term",
|
||||
},
|
||||
});
|
||||
const body = await res.json();
|
||||
|
||||
expect(res.status).toEqual(200);
|
||||
expect(body.data.length).toEqual(0);
|
||||
});
|
||||
|
||||
it("should return draft documents created by user if chosen", async () => {
|
||||
const { user } = await seed();
|
||||
const document = await buildDocument({
|
||||
|
@ -15,6 +15,9 @@ const SearchQuery = sequelize.define(
|
||||
},
|
||||
query: {
|
||||
type: DataTypes.STRING,
|
||||
set(val) {
|
||||
this.setDataValue("query", val.substring(0, 255));
|
||||
},
|
||||
allowNull: false,
|
||||
},
|
||||
results: {
|
||||
|
Reference in New Issue
Block a user