Parse dates on import
Tests are failing on postgres because on import we mix timestamps, dates and strings. We should parse the dates on import before passing them to the entities create methods.
16 failing
1) import
should run the import properly:
QueryFailedError: date/time field value out of range: "1546300800000"
at new QueryFailedError (src/error/QueryFailedError.ts:9:9)
at Query.callback (src/driver/postgres/PostgresQueryRunner.ts:178:30)
at Query.handleError (node_modules/pg/lib/query.js:145:17)
at Connection.connectedErrorMessageHandler (node_modules/pg/lib/client.js:214:17)
at Socket.<anonymous> (node_modules/pg/lib/connection.js:128:12)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
2) import
lastCheckDate
The lastCheckDate property of an account should equal the date of the latest operation if missing:
TypeError: Cannot read property 'lastCheckDate' of undefined
at _callee4$ (tests/server/import.js:243:113)
at tryCatch (node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:271:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:97:21)
at asyncGeneratorStep (tests/server/import.js:35:24)
at _next (tests/server/import.js:16:1)
at process._tickCallback (internal/process/next_tick.js:68:7)
3) import
lastCheckDate
The lastCheckDate property of an account should be ~now if missing & no operations:
QueryFailedError: date/time field value out of range: "1546300800000"
at new QueryFailedError (src/error/QueryFailedError.ts:9:9)
at Query.callback (src/driver/postgres/PostgresQueryRunner.ts:178:30)
at Query.handleError (node_modules/pg/lib/query.js:145:17)
at Connection.connectedErrorMessageHandler (node_modules/pg/lib/client.js:214:17)
at Socket.<anonymous> (node_modules/pg/lib/connection.js:128:12)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
4) import
lastCheckDate
The lastCheckDate property of an account should not be modified if defined in the import data:
QueryFailedError: date/time field value out of range: "1546300800000"
at new QueryFailedError (src/error/QueryFailedError.ts:9:9)
at Query.callback (src/driver/postgres/PostgresQueryRunner.ts:178:30)
at Query.handleError (node_modules/pg/lib/query.js:145:17)
at Connection.connectedErrorMessageHandler (node_modules/pg/lib/client.js:214:17)
at Socket.<anonymous> (node_modules/pg/lib/connection.js:128:12)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
5) import
label & rawLabel
The label should be used to fill the rawLabel field if missing:
TypeError: Cannot read property 'rawLabel' of undefined
at _callee7$ (tests/server/import.js:275:11)
at tryCatch (node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:271:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:97:21)
at asyncGeneratorStep (tests/server/import.js:35:24)
at _next (tests/server/import.js:16:1)
at process._tickCallback (internal/process/next_tick.js:68:7)
6) import
label & rawLabel
The rawLabel should be used to fill the label field if missing:
TypeError: Cannot read property 'label' of undefined
at _callee8$ (tests/server/import.js:275:9)
at tryCatch (node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:271:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:97:21)
at asyncGeneratorStep (tests/server/import.js:35:24)
at _next (tests/server/import.js:16:1)
at process._tickCallback (internal/process/next_tick.js:68:7)
7) import
Mandatory properties
Transactions without date, amount or labels and raw labels should be ignored:
AssertionError: expected 0 to be 8
+ expected - actual
-0
+8
at Assertion.fail (node_modules/should/cjs/should.js:275:17)
at Assertion.value (node_modules/should/cjs/should.js:356:19)
at _callee9$ (tests/server/import.js:291:11)
at tryCatch (node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:271:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:97:21)
at asyncGeneratorStep (tests/server/import.js:35:24)
at _next (tests/server/import.js:16:1)
at process._tickCallback (internal/process/next_tick.js:68:7)
8) import
importDate
should be set to now if missing:
TypeError: Cannot read property 'importDate' of undefined
at _callee10$ (tests/server/import.js:291:92)
at tryCatch (node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:271:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:97:21)
at asyncGeneratorStep (tests/server/import.js:35:24)
at _next (tests/server/import.js:16:1)
at process._tickCallback (internal/process/next_tick.js:68:7)
9) import
should apply renamings when importing
should successfully import Settings with the old format:
QueryFailedError: date/time field value out of range: "1546300800000"
at new QueryFailedError (src/error/QueryFailedError.ts:9:9)
at Query.callback (src/driver/postgres/PostgresQueryRunner.ts:178:30)
at Query.handleError (node_modules/pg/lib/query.js:145:17)
at Connection.connectedErrorMessageHandler (node_modules/pg/lib/client.js:214:17)
at Socket.<anonymous> (node_modules/pg/lib/connection.js:128:12)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
10) import
should apply renamings when importing
should have renamed Settings.name into Settings.key:
AssertionError: expected 1 to be 2
+ expected - actual
-1
+2
at Assertion.fail (node_modules/should/cjs/should.js:275:17)
at Assertion.value (node_modules/should/cjs/should.js:356:19)
at _callee12$ (tests/server/import.js:325:28)
at tryCatch (node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:271:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:97:21)
at asyncGeneratorStep (tests/server/import.js:35:24)
at _next (tests/server/import.js:16:1)
at process._tickCallback (internal/process/next_tick.js:68:7)
11) import
should apply renamings when importing
should successfully import Settings with the new format:
QueryFailedError: date/time field value out of range: "1546300800000"
at new QueryFailedError (src/error/QueryFailedError.ts:9:9)
at Query.callback (src/driver/postgres/PostgresQueryRunner.ts:178:30)
at Query.handleError (node_modules/pg/lib/query.js:145:17)
at Connection.connectedErrorMessageHandler (node_modules/pg/lib/client.js:214:17)
at Socket.<anonymous> (node_modules/pg/lib/connection.js:128:12)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
12) import
should apply renamings when importing
should have kept Settings.key:
AssertionError: expected 1 to be 2
+ expected - actual
-1
+2
at Assertion.fail (node_modules/should/cjs/should.js:275:17)
at Assertion.value (node_modules/should/cjs/should.js:356:19)
at _callee14$ (tests/server/import.js:343:71)
at tryCatch (node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:271:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:97:21)
at asyncGeneratorStep (tests/server/import.js:35:24)
at _next (tests/server/import.js:16:1)
at process._tickCallback (internal/process/next_tick.js:68:7)
13) import
should apply renamings when importing
should successfully do several renamings if needed:
QueryFailedError: date/time field value out of range: "1546300800000"
at new QueryFailedError (src/error/QueryFailedError.ts:9:9)
at Query.callback (src/driver/postgres/PostgresQueryRunner.ts:178:30)
at Query.handleError (node_modules/pg/lib/query.js:145:17)
at Connection.connectedErrorMessageHandler (node_modules/pg/lib/client.js:214:17)
at Socket.<anonymous> (node_modules/pg/lib/connection.js:128:12)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
14) import
should apply renamings when importing
should have applied the renamings in database:
AssertionError: expected 0 to be 9
+ expected - actual
-0
+9
at Assertion.fail (node_modules/should/cjs/should.js:275:17)
at Assertion.value (node_modules/should/cjs/should.js:356:19)
at _callee16$ (tests/server/import.js:371:34)
at tryCatch (node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:271:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:97:21)
at asyncGeneratorStep (tests/server/import.js:35:24)
at _next (tests/server/import.js:16:1)
at process._tickCallback (internal/process/next_tick.js:68:7)
15) import
"name" or "value" not being strings of access customField
should be ignored when imported:
QueryFailedError: date/time field value out of range: "1546300800000"
at new QueryFailedError (src/error/QueryFailedError.ts:9:9)
at Query.callback (src/driver/postgres/PostgresQueryRunner.ts:178:30)
at Query.handleError (node_modules/pg/lib/query.js:145:17)
at Connection.connectedErrorMessageHandler (node_modules/pg/lib/client.js:214:17)
at Socket.<anonymous> (node_modules/pg/lib/connection.js:128:12)
at addChunk (_stream_readable.js:288:12)
at readableAddChunk (_stream_readable.js:269:11)
at Socket.Readable.push (_stream_readable.js:224:10)
at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)
16) Testing kresus/weboob integration
with weboob not installed.
call "test" should raise "WEBOOB_NOT_INSTALLED" error, if weboob is not globally installed. WARNING: if this test fails, make sure Weboob is not installed globally before opening an issue.:
AssertionError: expected undefined to exist
at result (tests/server/kresus-weboob-integration.js:44:21)
at _callee$ (tests/server/kresus-weboob-integration.js:166:107)
at tryCatch (node_modules/regenerator-runtime/runtime.js:45:40)
at Generator.invoke [as _invoke] (node_modules/regenerator-runtime/runtime.js:271:22)
at Generator.prototype.(anonymous function) [as next] (node_modules/regenerator-runtime/runtime.js:97:21)
at asyncGeneratorStep (tests/server/kresus-weboob-integration.js:6:1)
at _next (tests/server/kresus-weboob-integration.js:23:37)
at process._tickCallback (internal/process/next_tick.js:68:7)
error Command failed with exit code 16.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Edited by Nicolas Frandeboeuf