-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add mock staterepo #73
base: master
Are you sure you want to change the base?
Conversation
private fun compare(a: Any, b: Any?, operator: String): Boolean { | ||
when (operator) { | ||
"==" -> { | ||
return when { | ||
a is ByteArray && b is ByteArray -> a.contentEquals(b as? ByteArray) | ||
a is Identifier && b is ByteArray -> a == Identifier.from(b) | ||
a is ByteArray && b is Identifier -> Identifier.from(a) == b | ||
else -> a == b | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to support some queries for DashPay.
a is Int && b is Int -> b.toInt() > a.toInt() | ||
a is Long && b is Long -> b.toLong() > a.toLong() | ||
a is Int && b is Long -> b.toInt() > a.toLong() | ||
a is Long && b is Int -> b.toLong() > a.toInt() | ||
else -> throw throw UnsupportedOperationException("> has unknown operands: " + a.javaClass.name + " and " + b?.javaClass?.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe this is over kill on the Ints and Longs
private fun loadMockData() { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is where we add mock data. Data is in CBOR format and can be taken from the logs of DashPay.
Currently there are two usernames that are created with profiles in this data. And one ContactRequest.
var stateRepository = if (mockDAPI()) { | ||
MockPlatformStateRepository(this) | ||
} else { | ||
PlatformStateRepository(this) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is written in a way to easily turn off mocking the data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great
This won't be merged for now, but instead will become the base branch for the Mocked State Repository. |
* feat: update asset lock handling to v20 * chore: ktlint * fix: update for dashj refactoring
Issue being fixed or feature implemented
What was done?
How Has This Been Tested?
Breaking Changes
Checklist:
For repository code-owners and collaborators only