fix: create new accounts with DISCONNECTED status so QR displays immediately
This commit is contained in:
@@ -17,7 +17,7 @@ const mockCreatedAccount = {
|
|||||||
platform: 'whatsapp',
|
platform: 'whatsapp',
|
||||||
jid: 'pending_uuid@placeholder',
|
jid: 'pending_uuid@placeholder',
|
||||||
displayName: 'My Number',
|
displayName: 'My Number',
|
||||||
status: 'ACTIVE',
|
status: 'DISCONNECTED',
|
||||||
};
|
};
|
||||||
|
|
||||||
const mockPrisma = {
|
const mockPrisma = {
|
||||||
@@ -82,13 +82,13 @@ describe('AccountsService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('create()', () => {
|
describe('create()', () => {
|
||||||
it('creates account with platform whatsapp and status ACTIVE', async () => {
|
it('creates account with platform whatsapp and status DISCONNECTED', async () => {
|
||||||
await service.create('My Number');
|
await service.create('My Number');
|
||||||
expect(mockPrisma.account.create).toHaveBeenCalledWith(
|
expect(mockPrisma.account.create).toHaveBeenCalledWith(
|
||||||
expect.objectContaining({
|
expect.objectContaining({
|
||||||
data: expect.objectContaining({
|
data: expect.objectContaining({
|
||||||
platform: 'whatsapp',
|
platform: 'whatsapp',
|
||||||
status: 'ACTIVE',
|
status: 'DISCONNECTED',
|
||||||
displayName: 'My Number',
|
displayName: 'My Number',
|
||||||
}),
|
}),
|
||||||
}),
|
}),
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ export class AccountsService {
|
|||||||
jid: `pending_${uid}@placeholder`,
|
jid: `pending_${uid}@placeholder`,
|
||||||
sessionPath: `${sessionBase}/${uid}`,
|
sessionPath: `${sessionBase}/${uid}`,
|
||||||
displayName: displayName ?? null,
|
displayName: displayName ?? null,
|
||||||
status: 'ACTIVE',
|
status: 'DISCONNECTED',
|
||||||
},
|
},
|
||||||
select: { id: true, platform: true, jid: true, displayName: true, status: true },
|
select: { id: true, platform: true, jid: true, displayName: true, status: true },
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user