2022-05-10 09:26:17 +00:00
|
|
|
import { assertDoesNotThrow } from 'backend/database/tests/helpers';
|
2022-05-11 10:44:31 +00:00
|
|
|
import { purchaseItemPartyMap } from 'dummy/helpers';
|
2022-10-31 07:33:50 +00:00
|
|
|
import test from 'tape';
|
|
|
|
import { getTestDbPath, getTestFyo } from 'tests/helpers';
|
2022-05-10 09:26:17 +00:00
|
|
|
import { setupDummyInstance } from '..';
|
|
|
|
|
2022-10-31 07:33:50 +00:00
|
|
|
const dbPath = getTestDbPath();
|
|
|
|
const fyo = getTestFyo();
|
2022-05-10 09:26:17 +00:00
|
|
|
|
2022-10-31 07:33:50 +00:00
|
|
|
test('setupDummyInstance', async () => {
|
|
|
|
await assertDoesNotThrow(async () => {
|
|
|
|
await setupDummyInstance(dbPath, fyo, 1, 25);
|
|
|
|
}, 'setup instance failed');
|
|
|
|
});
|
2022-05-10 09:26:17 +00:00
|
|
|
|
2022-10-31 07:33:50 +00:00
|
|
|
test('purchaseItemParty Existance', async (t) => {
|
|
|
|
for (const item in purchaseItemPartyMap) {
|
|
|
|
t.ok(await fyo.db.exists('Item', item), `item exists: ${item}`);
|
2022-05-11 10:44:31 +00:00
|
|
|
|
2022-10-31 07:33:50 +00:00
|
|
|
const party = purchaseItemPartyMap[item];
|
|
|
|
t.ok(await fyo.db.exists('Party', party), `party exists: ${party}`);
|
|
|
|
}
|
|
|
|
});
|
2022-05-11 10:44:31 +00:00
|
|
|
|
2022-10-31 07:33:50 +00:00
|
|
|
test.onFinish(async () => {
|
|
|
|
await fyo.close();
|
2022-05-10 09:26:17 +00:00
|
|
|
});
|