fix occupant name test
parent
f7b8874b0d
commit
b2dc453b44
|
|
@ -76,8 +76,7 @@ export function getOccupantNameWhereClause(occupantName = '', tableAlias = 'o')
|
|||
if (occupantNamePiece === '') {
|
||||
continue;
|
||||
}
|
||||
sqlWhereClause += ` and (instr(lower(${tableAlias}.occupantName), ?)
|
||||
or instr(lower(${tableAlias}.occupantFamilyName), ?))`;
|
||||
sqlWhereClause += ` and (instr(lower(${tableAlias}.occupantName), ?) or instr(lower(${tableAlias}.occupantFamilyName), ?))`;
|
||||
sqlParameters.push(occupantNamePiece, occupantNamePiece);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -108,8 +108,7 @@ export function getOccupantNameWhereClause(
|
|||
continue
|
||||
}
|
||||
|
||||
sqlWhereClause += ` and (instr(lower(${tableAlias}.occupantName), ?)
|
||||
or instr(lower(${tableAlias}.occupantFamilyName), ?))`
|
||||
sqlWhereClause += ` and (instr(lower(${tableAlias}.occupantName), ?) or instr(lower(${tableAlias}.occupantFamilyName), ?))`
|
||||
sqlParameters.push(occupantNamePiece, occupantNamePiece)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -200,7 +200,8 @@ describe('functions.sqlFilters', () => {
|
|||
describe('OccupantName filter', () => {
|
||||
it('returns filter', () => {
|
||||
const filter = sqlFilterFunctions.getOccupantNameWhereClause('TEST1 TEST2', 'o');
|
||||
assert.strictEqual(filter.sqlWhereClause, ' and instr(lower(o.occupantName), ?) and instr(lower(o.occupantName), ?)');
|
||||
assert.strictEqual(filter.sqlWhereClause, ' and (instr(lower(o.occupantName), ?) or instr(lower(o.occupantFamilyName), ?)) and (instr(lower(o.occupantName), ?) or instr(lower(o.occupantFamilyName), ?))');
|
||||
assert.ok(filter.sqlParameters.length === 4);
|
||||
assert.ok(filter.sqlParameters.includes('test1'));
|
||||
assert.ok(filter.sqlParameters.includes('test2'));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -346,9 +346,11 @@ describe('functions.sqlFilters', () => {
|
|||
|
||||
assert.strictEqual(
|
||||
filter.sqlWhereClause,
|
||||
' and instr(lower(o.occupantName), ?) and instr(lower(o.occupantName), ?)'
|
||||
' and (instr(lower(o.occupantName), ?) or instr(lower(o.occupantFamilyName), ?)) and (instr(lower(o.occupantName), ?) or instr(lower(o.occupantFamilyName), ?))'
|
||||
)
|
||||
|
||||
assert.ok(filter.sqlParameters.length === 4)
|
||||
|
||||
assert.ok(filter.sqlParameters.includes('test1'))
|
||||
assert.ok(filter.sqlParameters.includes('test2'))
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue