This repository has been archived by the owner on Jun 11, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cb22381
commit 3b85279
Showing
7 changed files
with
234 additions
and
2 deletions.
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
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,47 @@ | ||
/* | ||
* LiskHQ/lisk-service | ||
* Copyright © 2024 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. | ||
* | ||
*/ | ||
const { | ||
getCcmIDFromTopic0, | ||
getTransactionIDFromTopic0, | ||
} = require('../../../../shared/helpers/event'); | ||
|
||
describe('Event utils', () => { | ||
it('returns ccmID when called with valid topic (ccmID with prefix)', async () => { | ||
const topic = '05ce7082673acce922263e0256e717dc151fe86a88c6827bf53d42038ee387eca1'; | ||
const ccmID = getCcmIDFromTopic0(topic); | ||
const expectedResponse = 'ce7082673acce922263e0256e717dc151fe86a88c6827bf53d42038ee387eca1'; | ||
expect(ccmID).toBe(expectedResponse); | ||
}); | ||
|
||
it('returns null when called with ccmID without prefix', async () => { | ||
const topic = 'ce7082673acce922263e0256e717dc151fe86a88c6827bf53d42038ee387eca1'; | ||
const ccmID = getCcmIDFromTopic0(topic); | ||
expect(ccmID).toBeNull(); | ||
}); | ||
|
||
it('returns transactionID when called with valid topic (transactionID with prefix)', async () => { | ||
const topic = '04ce7082673acce922263e0256e717dc151fe86a88c6827bf53d42038ee387eca1'; | ||
const transactionID = getTransactionIDFromTopic0(topic); | ||
const expectedResponse = 'ce7082673acce922263e0256e717dc151fe86a88c6827bf53d42038ee387eca1'; | ||
expect(transactionID).toBe(expectedResponse); | ||
}); | ||
|
||
it('returns null when called with transactionID without prefix', async () => { | ||
const topic = 'ce7082673acce922263e0256e717dc151fe86a88c6827bf53d42038ee387eca1'; | ||
const ccmID = getTransactionIDFromTopic0(topic); | ||
expect(ccmID).toBeNull(); | ||
}); | ||
}); |
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