mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
sql: add more tests (#74919)
This commit is contained in:
parent
d2707e85af
commit
fb0357947f
@ -87,7 +87,25 @@ describe('SQLWhereRow', () => {
|
||||
expect(exp.whereString).toBe('hostname IN (${multiHost})');
|
||||
});
|
||||
|
||||
it('should not remove quotes in a where clause not including a multi-value variable', () => {
|
||||
it('should not remove quotes in a where clause including a non-multi variable', () => {
|
||||
const exp: SQLExpression = {
|
||||
whereString: "hostname IN ('${host}')",
|
||||
};
|
||||
|
||||
const multiVar = customBuilder().withId('multiVar').withName('multiHost').build();
|
||||
const nonMultiVar = customBuilder().withId('nonMultiVar').withName('host').build();
|
||||
|
||||
multiVar.multi = true;
|
||||
nonMultiVar.multi = false;
|
||||
|
||||
const variables = [multiVar, nonMultiVar];
|
||||
|
||||
removeQuotesForMultiVariables(exp, variables);
|
||||
|
||||
expect(exp.whereString).toBe("hostname IN ('${host}')");
|
||||
});
|
||||
|
||||
it('should not remove quotes in a where clause not including any known variables', () => {
|
||||
const exp: SQLExpression = {
|
||||
whereString: "hostname IN ('${nonMultiHost}')",
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user