Skip to content

Commit

Permalink
fix: improve code
Browse files Browse the repository at this point in the history
  • Loading branch information
shuffledex committed Mar 11, 2020
1 parent e30957c commit f9492a0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/api/procedures/__tests__/reserveTicker.ts
Expand Up @@ -173,7 +173,7 @@ describe('reserveTicker procedure', () => {
);
});

test('should throw an error if extendPeriod property is set to true and the ticker has not reserved or the reservation has expired', async () => {
test('should throw an error if extendPeriod property is set to true and the ticker has not been reserved or the reservation has expired', async () => {
const expiryDate = new Date(2019, 1, 1);
mockTickerReservation.mock('details', {
ownerDid: 'someDid',
Expand Down Expand Up @@ -214,7 +214,7 @@ describe('reserveTicker procedure', () => {
proc.context = mockContext;

return expect(prepareReserveTicker.call(proc, { ...args, extendPeriod: true })).rejects.toThrow(
'You must be the owner of the ticker to extend its registration period'
'You must be the owner of the ticker to extend its reservation period'
);
});

Expand Down
2 changes: 1 addition & 1 deletion src/api/procedures/reserveTicker.ts
Expand Up @@ -78,7 +78,7 @@ export async function prepareReserveTicker(
} else if (ownerDid !== context.currentIdentity?.did) {
throw new PolymeshError({
code: ErrorCode.ValidationError,
message: 'You must be the owner of the ticker to extend its registration period',
message: 'You must be the owner of the ticker to extend its reservation period',
});
}
}
Expand Down
3 changes: 2 additions & 1 deletion src/testUtils/mocks/PolkadotMockFactory.ts
Expand Up @@ -38,6 +38,7 @@ interface TxMockData {
}

interface ContextOptions {
did?: string;
withSeed?: boolean;
balance?: BigNumber;
}
Expand Down Expand Up @@ -233,7 +234,7 @@ export class PolkadotMockFactory {
*/
private initContext(opts: ContextOptions): void {
const currentIdentity = opts.withSeed
? { getIdentityBalance: sinon.stub().resolves(opts.balance), did: 'someDid' }
? { getIdentityBalance: sinon.stub().resolves(opts.balance), did: opts.did || 'someDid' }
: undefined;
const currentPair = opts.withSeed
? ({
Expand Down

0 comments on commit f9492a0

Please sign in to comment.