0
Fork 0
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:
simeng-li 2022-10-08 14:47:30 +08:00 committed by GitHub
parent ba01f13bfa
commit 11b605a3e7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 5 deletions

View file

@ -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]);
});

View file

@ -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) {