Skip to content

Commit

Permalink
#20 Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
ceres3idoo committed Feb 25, 2019
1 parent e3b6226 commit 45ca7c2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 11 deletions.
3 changes: 0 additions & 3 deletions src/commands/commandList.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,6 @@ const getBalanceCommand = new GetBalanceCommand(logger, tradingWalletService,
const createWalletCommand = new CreateWalletCommand(logger, getAllowanceCommandValidator,
createWalletCommandValidator, privateKeyService, privateKeyValidator)

const getTradingWalletBalanceCommand = new GetTradingWalletBalanceCommand(logger, tradingWalletService,
getTradingWalletBalanceCommandValidator, privateKeyService, privateKeyValidator)

const depositEthCommand = new DepositEthCommand(logger, tradingWalletService,
depositEthCommandValidator, privateKeyService, privateKeyValidator)

Expand Down
4 changes: 2 additions & 2 deletions src/commands/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const commandList = require('./commandList')
const CreateWalletCommand = require('./CreateWalletCommand')
const DepositEthCommand = require('./DepositEthCommand')
const GetAddressCommand = require('./GetAddressCommand')
const GetTradingWalletBalanceCommand = require('./GetBalanceCommand')
const GetBalanceCommand = require('./GetBalanceCommand')
const OrderSignCommand = require('./OrderSignCommand')

module.exports = {
Expand All @@ -14,6 +14,6 @@ module.exports = {
CreateWalletCommand,
DepositEthCommand,
GetAddressCommand,
GetTradingWalletBalanceCommand,
GetBalanceCommand,
OrderSignCommand,
}
12 changes: 6 additions & 6 deletions tests/unit/commands/getTradingWalletBalanceCommand.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const tradingWalletService = TradingWalletServiceBuilder.build()
const privateKeyValidator = new PrivateKeyValidator(logger)
const privateKeyService = new PrivateKeyService(logger)

const getTradingWalletBalanceCommand = new GetBalanceCommand(logger, tradingWalletService,
const getBalanceCommand = new GetBalanceCommand(logger, tradingWalletService,
getBalanceCommandValidator, privateKeyService, privateKeyValidator)

afterEach(() => {
Expand All @@ -41,7 +41,7 @@ describe('tws get-balance', () => {
},
]

const result = await getTradingWalletBalanceCommand
const result = await getBalanceCommand
.executeAsync({ from: invalidFrom, to, token })

expect(result).toMatchObject(expectedResult)
Expand All @@ -55,19 +55,19 @@ describe('tws get-balance', () => {
message: 'from is required',
}]

const result = await getTradingWalletBalanceCommand.executeAsync({ from, to, token })
const result = await getBalanceCommand.executeAsync({ from, to, token })
expect(result).toMatchObject(expectedResult)
})
})

describe('should execute GetTradingWalletBalanceCommand as expected', () => {
describe('should execute GetBalanceCommand as expected', () => {
const draftValues = [false, undefined]
test.each(draftValues)('should return the tradingWallet asset balance with draft value = %o', async (draft) => {
const expectedTradinWalletAssetBalance = '1'
sandbox.stub(tradingWalletService.transactionLib.ethApiClient, 'transactionCallAsync')
.returns(expectedTradinWalletAssetBalance)

const result = await getTradingWalletBalanceCommand.executeAsync({ from, to, token, draft })
const result = await getBalanceCommand.executeAsync({ from, to, token, draft })
expect(result).toBe(expectedTradinWalletAssetBalance)
})

Expand All @@ -79,7 +79,7 @@ describe('tws get-balance', () => {
value: '0x0',
}

const result = await getTradingWalletBalanceCommand
const result = await getBalanceCommand
.executeAsync({ from, to, token, draft: true })

expect(result).toMatchObject(expectedTransactionObjectDraft)
Expand Down

0 comments on commit 45ca7c2

Please sign in to comment.