Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5516 from LiskHQ/5497-add_getschema_action_on_fra…
…mework Add getSchema action on framework - Closes #5497
- Loading branch information
Showing
5 changed files
with
122 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
83 changes: 83 additions & 0 deletions
83
framework/test/functional/specs/actions/application.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* Copyright © 2020 Lisk Foundation | ||
* | ||
* See the LICENSE file at the top-level directory of this distribution | ||
* for licensing information. | ||
* | ||
* Unless otherwise agreed in a custom licensing agreement with the Lisk Foundation, | ||
* no part of this software, including this file, may be copied, modified, | ||
* propagated, or distributed except according to the terms contained in the | ||
* LICENSE file. | ||
* | ||
* Removal or modification of this copyright notice is prohibited. | ||
*/ | ||
import { blockSchema, baseAccountSchema } from '@liskhq/lisk-chain'; | ||
|
||
import { | ||
TransferTransaction, | ||
DelegateTransaction, | ||
VoteTransaction, | ||
UnlockTransaction, | ||
MultisignatureTransaction, | ||
ProofOfMisbehaviorTransaction, | ||
BaseTransaction, | ||
} from '@liskhq/lisk-transactions'; | ||
import { accountAssetSchema } from '../../../../src/application/node/account'; | ||
|
||
import { BlockProcessorV0 } from '../../../../src/application/node/block_processor_v0'; | ||
import { BlockProcessorV2 } from '../../../../src/application/node/block_processor_v2'; | ||
|
||
import { createApplication, closeApplication } from '../../utils/application'; | ||
|
||
import { Application } from '../../../../src'; | ||
|
||
describe('Application related actions', () => { | ||
let app: Application; | ||
|
||
beforeAll(async () => { | ||
app = await createApplication('actions-transactions'); | ||
}); | ||
|
||
afterAll(async () => { | ||
await closeApplication(app); | ||
}); | ||
|
||
describe('getSchema', () => { | ||
it('should return schemas used to encode objects in framework', async () => { | ||
const frameworkSchemas = await app['_channel'].invoke('app:getSchema'); | ||
|
||
const accountSchema = { | ||
...baseAccountSchema, | ||
properties: { | ||
...baseAccountSchema.properties, | ||
asset: { | ||
...baseAccountSchema.properties.asset, | ||
properties: accountAssetSchema, | ||
}, | ||
}, | ||
}; | ||
|
||
const expectedFrameworkSchemas = { | ||
account: accountSchema, | ||
blockHeader: blockSchema, | ||
blockHeadersAssets: { | ||
0: BlockProcessorV0.schema, | ||
2: BlockProcessorV2.schema, | ||
}, | ||
baseTransaction: BaseTransaction.BASE_SCHEMA, | ||
transactionsAssets: { | ||
[TransferTransaction.TYPE]: TransferTransaction.ASSET_SCHEMA, | ||
[DelegateTransaction.TYPE]: DelegateTransaction.ASSET_SCHEMA, | ||
[VoteTransaction.TYPE]: VoteTransaction.ASSET_SCHEMA, | ||
[UnlockTransaction.TYPE]: UnlockTransaction.ASSET_SCHEMA, | ||
[MultisignatureTransaction.TYPE]: | ||
MultisignatureTransaction.ASSET_SCHEMA, | ||
[ProofOfMisbehaviorTransaction.TYPE]: | ||
ProofOfMisbehaviorTransaction.ASSET_SCHEMA, | ||
}, | ||
}; | ||
|
||
expect(frameworkSchemas).toEqual(expectedFrameworkSchemas); | ||
}); | ||
}); | ||
}); |