Skip to content

Commit

Permalink
[explorer] task: apply eslint rules in test folder #1111
Browse files Browse the repository at this point in the history
* [explorer] task: added e2e tests to eslint, apply symbol eslint rules

* [explorer] task: lint fix for unit test

* [explorer] task: lint fix for e2e folder

* [explorer] task: lint fix for PR #1109
  • Loading branch information
AnthonyLaw authored Sep 21, 2022
1 parent 3f75524 commit 4b223fe
Show file tree
Hide file tree
Showing 43 changed files with 1,802 additions and 1,963 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
extends:
- plugin:vue/essential
- ./default.eslintrc
- ./_symbol/linters/javascript/default.eslintrc
plugins:
- import
parserOptions:
Expand Down
44 changes: 22 additions & 22 deletions __tests__/TestHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
Mosaic,
UInt64,
MosaicId,
TransactionType,
TransactionType
} from 'symbol-sdk';

const generateRandomHash = (length = 32) => {
Expand Down Expand Up @@ -38,15 +38,15 @@ const transactionCommonField = {
timestamp: 1646063763,
feeMultiplier: 10,
hash: generateRandomHash()
},
}
}
};

const receiptCommonField = {
amount: UInt64.fromUint(10000000),
height: UInt64.fromUint(1000),
mosaicId: new MosaicId('6BED913FA20223F8'),
version: 1
}
};

const TestHelper = {
/**
Expand Down Expand Up @@ -272,16 +272,16 @@ const TestHelper = {
version: 1
};
},
mockMosaicSupplyRevocationTransaction: (mosaic) => {
mockMosaicSupplyRevocationTransaction: mosaic => {
return {
...transactionCommonField,
mosaic,
sourceAddress: Account.generateNewAccount(NetworkType.TEST_NET).address,
type: TransactionType.MOSAIC_SUPPLY_REVOCATION,
version: 1,
version: 1
};
},
mockSecretLockTransaction: (mosaic) => {
mockSecretLockTransaction: mosaic => {
return {
...transactionCommonField,
mosaic,
Expand All @@ -291,19 +291,19 @@ const TestHelper = {
recipientAddress: {
address: Account.generateNewAccount(NetworkType.TEST_NET).address
},
secret: "FFF86D517ACFBCD86229CBDCECF9E7F777EF0B5FB54B15D794C68C33942A09D8"
secret: 'FFF86D517ACFBCD86229CBDCECF9E7F777EF0B5FB54B15D794C68C33942A09D8'
};
},
mockLockFundsTransaction: () => {
return {
...transactionCommonField,
duration: UInt64.fromUint(10),
hash: "5547B43ECBCA8C90114BBD2C741D609719A0C61C7B03049125521ECE2415E376",
hash: '5547B43ECBCA8C90114BBD2C741D609719A0C61C7B03049125521ECE2415E376',
mosaic: new Mosaic(new MosaicId('6BED913FA20223F8'), UInt64.fromUint(10)),
type: TransactionType.HASH_LOCK,
type: TransactionType.HASH_LOCK
};
},
createFormattedHashLockTransaction: (status) => {
createFormattedHashLockTransaction: status => {
return {
amount: UInt64.fromUint(10000000),
endHeight: 10,
Expand All @@ -313,22 +313,22 @@ const TestHelper = {
recordId: '631FA269464297FBEBEFE0ED',
status,
version: 1
}
};
},
createFormattedSecretLockTransaction: (mosaicIdHex, amount, status) => {
return {
amount: UInt64.fromUint(amount),
compositeHash: generateRandomHash(64),
hashAlgorithm: "Sha3 256",
hashAlgorithm: 'Sha3 256',
endHeight: 10,
mosaicId: new MosaicId(mosaicIdHex),
ownerAddress: Account.generateNewAccount(NetworkType.TEST_NET).address.plain(),
recipient: Account.generateNewAccount(NetworkType.TEST_NET).address.plain(),
recordId: '631FA269464297FBEBEFE0ED',
secret: "112233445566",
secret: '112233445566',
status,
version: 1
}
};

},
mockBalanceChangeReceipt: (amount, mosaicIdHex, type) => {
Expand All @@ -337,31 +337,31 @@ const TestHelper = {
amount: UInt64.fromUint(amount),
mosaicId: new MosaicId(mosaicIdHex),
targetAddress: Account.generateNewAccount(NetworkType.TEST_NET).address,
type,
}
type
};
},
mockBalanceTransferReceipt: (amount, type) => {
return {
...receiptCommonField,
amount: UInt64.fromUint(amount),
recipientAddress: Account.generateNewAccount(NetworkType.TEST_NET).address,
senderAddress: Account.generateNewAccount(NetworkType.TEST_NET).address,
type,
}
type
};
},
mockInflationReceipt: () => {
return {
...receiptCommonField,
type: 20803,
}
type: 20803
};
},
mockArtifactExpiryReceipt: (artifactId, type) => {
return {
artifactId,
height: UInt64.fromUint(1000),
version: 1,
type
}
};
}
};

Expand Down
10 changes: 5 additions & 5 deletions __tests__/components/controls/ButtonCopy.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('CopyButton component', () => {
wrapper = setupStoreMount();
});

afterEach(restore)
afterEach(restore);

it('processes props data', () => {
// Assert:
Expand All @@ -58,8 +58,8 @@ describe('CopyButton component', () => {
// Arrange:
stub(helper, 'copyTextToClipboard').returns(Promise.resolve());

const mockSuccessMsgMethod = jest.fn()
wrapper.setMethods({ successMsg: mockSuccessMsgMethod })
const mockSuccessMsgMethod = jest.fn();
wrapper.setMethods({ successMsg: mockSuccessMsgMethod });

// Act:
await wrapper.vm.onCopyClick();
Expand All @@ -72,8 +72,8 @@ describe('CopyButton component', () => {
// Arrange:
stub(helper, 'copyTextToClipboard').returns(Promise.reject(Error('error')));

const mockErrorMsgMethod = jest.fn()
wrapper.setMethods({ errorMsg: mockErrorMsgMethod })
const mockErrorMsgMethod = jest.fn();
wrapper.setMethods({ errorMsg: mockErrorMsgMethod });

// Act:
await wrapper.vm.onCopyClick();
Expand Down
Loading

0 comments on commit 4b223fe

Please sign in to comment.