Skip to content

Commit

Permalink
Tweak test case location for getStateUsage() method
Browse files Browse the repository at this point in the history
  • Loading branch information
platfowner committed Mar 25, 2024
1 parent 3374419 commit 64ffcf7
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 27 deletions.
44 changes: 22 additions & 22 deletions __tests__/__snapshots__/ain.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,27 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`ain-js Core getStateUsage 1`] = `
Object {
"available": Object {
"tree_bytes": 25000000,
"tree_height": 30,
"tree_size": 156250,
},
"protoVer": "erased",
"staking": Object {
"app": 0,
"total": 2,
"unstakeable": 0,
},
"usage": Object {
"tree_bytes": 0,
"tree_height": 0,
"tree_max_siblings": 0,
"tree_size": 0,
},
}
`;

exports[`ain-js Database evalOwner 1`] = `
Object {
"code": 0,
Expand Down Expand Up @@ -205,6 +183,28 @@ Object {
}
`;

exports[`ain-js Database getStateUsage 1`] = `
Object {
"available": Object {
"tree_bytes": 25000000,
"tree_height": 30,
"tree_size": 156250,
},
"protoVer": "erased",
"staking": Object {
"app": 0,
"total": 2,
"unstakeable": 0,
},
"usage": Object {
"tree_bytes": 0,
"tree_height": 0,
"tree_max_siblings": 0,
"tree_size": 0,
},
}
`;

exports[`ain-js Database matchFunction 1`] = `
Object {
"matched_config": Object {
Expand Down
17 changes: 12 additions & 5 deletions __tests__/ain.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -632,11 +632,6 @@ describe('ain-js', function() {
// expect(await ain.getTransactionResult('0xabcdefghijklmnop')).toMatchSnapshot();
// });

it('getStateUsage', async function() {
// with an app that does not exist yet
expect(eraseProtoVer(await ain.getStateUsage('test_new'))).toMatchSnapshot();
});

it('validateAppName returns true', async function () {
expect(eraseProtoVer(await ain.validateAppName('test_new'))).toStrictEqual({
"is_valid": true,
Expand Down Expand Up @@ -1449,6 +1444,18 @@ describe('ain-js', function() {
})
});

it('getStateUsage', async function() {
// with an app that does not exist yet
await ain.getStateUsage('test_new')
.then(res => {
expect(eraseProtoVer(res)).toMatchSnapshot();
})
.catch(error => {
console.log("error:", error);
fail('should not happen');
})
});

/*it('on and off', function(done) {
try {
ain.db.ref().on('value', (snap:any) => console.log)
Expand Down

0 comments on commit 64ffcf7

Please sign in to comment.