mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 04:40:32 +00:00
fix: Fix and test expense publish.
This commit is contained in:
@@ -716,4 +716,24 @@ describe('routes: /expenses/', () => {
|
||||
expect(foundExpenses.length).equals(0);
|
||||
})
|
||||
});
|
||||
|
||||
describe('POST: `/api/expenses/:id/publish`', () => {
|
||||
it('Should publish the given expense.', async () => {
|
||||
const expense = await tenantFactory.create('expense', {
|
||||
published: 0,
|
||||
});
|
||||
|
||||
const res = await request()
|
||||
.post(`/api/expenses/${expense.id}/publish`)
|
||||
.set('x-access-token', loginRes.body.token)
|
||||
.set('organization-id', tenantWebsite.organizationId)
|
||||
.send();
|
||||
|
||||
const foundExpense = await Expense.tenant().query()
|
||||
.where('id', expense.id).first();
|
||||
|
||||
expect(res.status).equals(200);
|
||||
expect(foundExpense.published).equals(1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user