Skip to content
Snippets Groups Projects
Commit 541335a3 authored by Cédric Moreau's avatar Cédric Moreau
Browse files

Merge branch 'feature/transactions-history-invalid' into 'dev'

[fix] #1350 Time of transactions not being saved on SQLite table

See merge request !1276
parents 14074533 6b8195ef
No related branches found
No related tags found
1 merge request!1276[fix] #1350 Time of transactions not being saved on SQLite table
......@@ -87,6 +87,7 @@ export class SqliteTransactions extends SqliteTable<DBTx> implements TxsDAO {
const theDBTx = DBTx.fromTransactionDTO(tx)
theDBTx.written = true
theDBTx.block_number = block_number
theDBTx.time = time
if (!dbTx) {
await this.insert(theDBTx)
}
......
......@@ -22,6 +22,9 @@ const assert = require('assert');
describe("Testing transactions", function() {
const now = 1490000000;
const yesterday = now - 86400;
const tomorrow = now + 86400;
const intwodays = now + (86400 * 2);
let s1:TestingServer, tic:TestUser, toc:TestUser
......@@ -77,6 +80,27 @@ describe("Testing transactions", function() {
])
})
describe("History by time", function(){
it('should have a time not null', () => s1.expect('/tx/history/DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo', (res:any) => {
res.should.have.property('pubkey').equal('DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo');
res.should.have.property('history').property('received').length(1);
res.history.received[0].should.have.property('time').not.be.Null;
res.history.received[0].should.have.property('time').be.a.Number;
}));
it('should return a received transaction between yesterday and tomorrow', () => s1.expect('/tx/history/DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo/times/' + yesterday + '/' + tomorrow, (res:any) => {
res.should.have.property('pubkey').equal('DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo');
res.should.have.property('history').property('received').length(1);
res.history.received[0].should.have.property('time').not.be.Null;
res.history.received[0].should.have.property('time').be.a.Number;
}));
it('should not return a received transaction the day after tomorrow', () => s1.expect('/tx/history/DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo/times/' + tomorrow + '/' + intwodays, (res:any) => {
res.should.have.property('pubkey').equal('DKpQPUL4ckzXYdnDRvCRKAm1gNvSdmAXnTrJZ7LvM5Qo');
res.should.have.property('history').property('received').length(0);
}));
})
describe("Sources", function(){
it('it should exist block#2 with UD of 1200', () => s1.expect('/blockchain/block/2', (block:any) => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment