Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

Commit

Permalink
feat: add unit tests for tags method
Browse files Browse the repository at this point in the history
  • Loading branch information
fuadop committed Feb 16, 2022
1 parent 2f93152 commit de2b23a
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions src/__tests__/ardb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,31 @@ describe('USING ARWEAVE', () => {

expect(txs[0].id).not.toBe('5AYV-RdPCoyfjeeabHVnDGvXrFNM5azcTlkNpp7RQhE');
});

test('tags', async () => {
let txs = await ardb
.search('transactions')
.appName('SmartWeaveAction')
.tag('Type', 'ArweaveActivity')
.only('id')
.sort('HEIGHT_ASC')
.find();

let tagsTx = await ardb
.search('transactions')
.tag('Type', 'ArweaveActivity')
.tags([
{
name: 'App-Name',
values: 'SmartWeaveAction'
}
])
.only('id')
.sort('HEIGHT_ASC')
.find();

expect(txs.length).toEqual(tagsTx.length)
})
});

describe('USING BLOCKWEAVE', () => {
Expand Down Expand Up @@ -275,4 +300,29 @@ describe('USING BLOCKWEAVE', () => {

expect(txs[0].id).not.toBe('5AYV-RdPCoyfjeeabHVnDGvXrFNM5azcTlkNpp7RQhE');
});

test('tags', async () => {
let txs = await ardb
.search('transactions')
.appName('SmartWeaveAction')
.tag('Type', 'ArweaveActivity')
.only('id')
.sort('HEIGHT_ASC')
.find();

let tagsTx = await ardb
.search('transactions')
.tag('Type', 'ArweaveActivity')
.tags([
{
name: 'App-Name',
values: 'SmartWeaveAction'
}
])
.only('id')
.sort('HEIGHT_ASC')
.find();

expect(txs.length).toEqual(tagsTx.length)
})
});

0 comments on commit de2b23a

Please sign in to comment.