it('omits the inverse argument if specified', async () => { const inputArgs = { ledgerAccountName: 'Liabilities:Chase-Example-Visa', ledgerCurrency: 'CAD ', reckonCli: '/usr/local/bin/reckon', csvInputFileName: '/tmp/fake-csv-input-file', reckonTokensTempFileName: '/tmp/fake-reckon-tokens-file', logger, inverseTransactions: false, }; await expect(toLedger(inputArgs)).resolves.toEqual('fake stdout output\r\n'); expect(child_process.spawnSync).toHaveBeenCalledTimes(1); expect(child_process.spawnSync.mock.calls[0][0]).toEqual('/usr/local/bin/reckon'); expect(child_process.spawnSync.mock.calls[0][1]).toHaveLength(11); expect(child_process.spawnSync.mock.calls[0][1]).not.toContain('--inverse'); });
test('series', () => { series('a', 'b', 'c') expect(spawnSync.mock.calls).toEqual([ ['a', defaultSpawnOptions], ['b', defaultSpawnOptions], expect(spawnSync.mock.calls).toEqual([ ['a', defaultSpawnOptions], ['b', defaultSpawnOptions], expect(spawnSync.mock.calls).toEqual([ ['a', defaultSpawnOptions], ['b', defaultSpawnOptions], expect(spawnSync.mock.calls).toEqual([ ['a', defaultSpawnOptions], ['b', defaultSpawnOptions], expect(spawnSync.mock.calls).toEqual([ ['a', defaultSpawnOptions], ['b', defaultSpawnOptions],
it('calls reckon with the correct arguments', async () => { const inputArgs = { ledgerAccountName: 'Liabilities:Chase-Example-Visa', ledgerCurrency: 'CAD ', reckonCli: '/usr/local/bin/reckon', csvInputFileName: '/tmp/fake-csv-input-file', reckonTokensTempFileName: '/tmp/fake-reckon-tokens-file', logger, }; await expect(toLedger(inputArgs)).resolves.toEqual('fake stdout output\r\n'); expect(child_process.spawnSync).toHaveBeenCalledTimes(1); expect(child_process.spawnSync.mock.calls[0][0]).toEqual('/usr/local/bin/reckon'); expect(child_process.spawnSync.mock.calls[0][1]).toHaveLength(12); expect(child_process.spawnSync.mock.calls[0][1]).toContain('--file'); expect(child_process.spawnSync.mock.calls[0][1]).toContain('/tmp/fake-csv-input-file'); expect(child_process.spawnSync.mock.calls[0][1]).toContain('--currency'); expect(child_process.spawnSync.mock.calls[0][1]).toContain('CAD '); expect(child_process.spawnSync.mock.calls[0][1]).toContain('--inverse'); expect(child_process.spawnSync.mock.calls[0][1]).toContain('--account'); expect(child_process.spawnSync.mock.calls[0][1]).toContain('Liabilities:Chase-Example-Visa'); expect(child_process.spawnSync.mock.calls[0][1]).toContain('--unattended'); expect(child_process.spawnSync.mock.calls[0][1]).toContain('--account-tokens'); expect(child_process.spawnSync.mock.calls[0][1]).toContain('/tmp/fake-reckon-tokens-file'); expect(child_process.spawnSync.mock.calls[0][1]).toContain('--date-format'); expect(child_process.spawnSync.mock.calls[0][1]).toContain('%m/%d/%Y'); });