mirror of
https://github.com/logto-io/logto.git
synced 2025-01-06 20:40:08 -05:00
fix(core): fix deletePasscodeByIds bug (#2049)
This commit is contained in:
parent
ba01f13bfa
commit
11b605a3e7
2 changed files with 5 additions and 5 deletions
|
@ -133,12 +133,12 @@ describe('passcode query', () => {
|
|||
const ids = ['foo', 'foo2'];
|
||||
const expectSql = sql`
|
||||
delete from ${table}
|
||||
where ${fields.id} in (${ids.join(',')})
|
||||
where ${fields.id} in (${sql.join(ids, sql`,`)})
|
||||
`;
|
||||
|
||||
mockQuery.mockImplementationOnce(async (sql, values) => {
|
||||
expectSqlAssert(sql, expectSql.sql);
|
||||
expect(values).toEqual([ids.join(',')]);
|
||||
expect(values).toEqual(ids);
|
||||
|
||||
return createMockQueryResult([mockPasscode, mockPasscode]);
|
||||
});
|
||||
|
@ -150,12 +150,12 @@ describe('passcode query', () => {
|
|||
const ids = ['foo', 'foo2'];
|
||||
const expectSql = sql`
|
||||
delete from ${table}
|
||||
where ${fields.id} in (${ids.join(',')})
|
||||
where ${fields.id} in (${sql.join(ids, sql`,`)})
|
||||
`;
|
||||
|
||||
mockQuery.mockImplementationOnce(async (sql, values) => {
|
||||
expectSqlAssert(sql, expectSql.sql);
|
||||
expect(values).toEqual([ids.join(',')]);
|
||||
expect(values).toEqual(ids);
|
||||
|
||||
return createMockQueryResult([mockPasscode]);
|
||||
});
|
||||
|
|
|
@ -56,7 +56,7 @@ export const deletePasscodeById = async (id: string) => {
|
|||
export const deletePasscodesByIds = async (ids: string[]) => {
|
||||
const { rowCount } = await envSet.pool.query(sql`
|
||||
delete from ${table}
|
||||
where ${fields.id} in (${ids.join(',')})
|
||||
where ${fields.id} in (${sql.join(ids, sql`,`)})
|
||||
`);
|
||||
|
||||
if (rowCount !== ids.length) {
|
||||
|
|
Loading…
Reference in a new issue