File tree Expand file tree Collapse file tree 3 files changed +41
-0
lines changed
modules/sdk-coin-ada/test/unit/messages Expand file tree Collapse file tree 3 files changed +41
-0
lines changed Original file line number Diff line number Diff line change 1+ export * from './cip8Message' ;
2+ export * from './cip8MessageBuilder' ;
3+ export * from './messageBuilderFactory' ;
4+ export * from './utils' ;
Original file line number Diff line number Diff line change 1+ import should from 'should' ;
2+ import sinon from 'sinon' ;
3+ import { BaseCoin } from '@bitgo/statics' ;
4+ import { MessageStandardType } from '@bitgo/sdk-core' ;
5+ import { Cip8MessageBuilder , MessageBuilderFactory } from '../../../../src/lib/messages' ;
6+
7+ describe ( 'MessageBuilderFactory' , function ( ) {
8+ let sandbox : sinon . SinonSandbox ;
9+ let factory : MessageBuilderFactory ;
10+ const coinConfig = { name : 'tada' } as BaseCoin ;
11+
12+ beforeEach ( function ( ) {
13+ sandbox = sinon . createSandbox ( ) ;
14+ factory = new MessageBuilderFactory ( coinConfig ) ;
15+ } ) ;
16+
17+ afterEach ( function ( ) {
18+ sandbox . restore ( ) ;
19+ } ) ;
20+
21+ describe ( 'getMessageBuilder' , function ( ) {
22+ it ( 'should return CIP8 message builder for CIP8 type' , function ( ) {
23+ const builder = factory . getMessageBuilder ( MessageStandardType . CIP8 ) ;
24+ should . exist ( builder ) ;
25+ builder . should . be . instanceof ( Cip8MessageBuilder ) ;
26+ } ) ;
27+
28+ it ( 'should throw error for unsupported message type' , function ( ) {
29+ const unsupportedTypes = [ 'UNSUPPORTED' as MessageStandardType ] ;
30+
31+ unsupportedTypes . forEach ( ( type ) => {
32+ should . throws ( ( ) => factory . getMessageBuilder ( type ) , / I n v a l i d m e s s a g e s t a n d a r d U N S U P P O R T E D / ) ;
33+ } ) ;
34+ } ) ;
35+ } ) ;
36+ } ) ;
Original file line number Diff line number Diff line change 1+ export * from './cip8' ;
You can’t perform that action at this time.
0 commit comments