-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into ProductTestIssue
- Loading branch information
Showing
7 changed files
with
69 additions
and
5 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
16 changes: 16 additions & 0 deletions
16
Mimir.Tests/QueryTests/PledgeTest.GraphQL_Query_Pledge_Returns_CorrectValue.verified.txt
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,16 @@ | ||
{ | ||
"data": { | ||
"pledge": { | ||
"address": "0x0000000000000000000000000000000000000000", | ||
"contractAddress": "0x0000000000000000000000000000000000000000", | ||
"contracted": true, | ||
"id": "0000000000000000000000000000000000000000", | ||
"refillMead": 10, | ||
"storedBlockIndex": 10000, | ||
"metadata": { | ||
"schemaVersion": 1, | ||
"storedBlockIndex": 10000 | ||
} | ||
} | ||
} | ||
} |
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,43 @@ | ||
using Libplanet.Crypto; | ||
using Mimir.MongoDB.Bson; | ||
using Mimir.MongoDB.Repositories; | ||
using Mimir.Tests; | ||
using Moq; | ||
|
||
public class PledgeTest | ||
{ | ||
[Fact] | ||
public async Task GraphQL_Query_Pledge_Returns_CorrectValue() | ||
{ | ||
var mockRepo = new Mock<IPledgeRepository>(); | ||
mockRepo | ||
.Setup(repo => repo.GetByAddressAsync(It.IsAny<Address>())) | ||
.ReturnsAsync(new PledgeDocument(10000, default, default, true, 10)); | ||
|
||
var serviceProvider = TestServices.Builder | ||
.With(mockRepo.Object) | ||
.Build(); | ||
|
||
var address = "0x0000008001000000000200000000030000000004"; | ||
var query = $$""" | ||
query { | ||
pledge(agentAddress: "{{address}}") { | ||
address | ||
contractAddress | ||
contracted | ||
id | ||
refillMead | ||
storedBlockIndex | ||
metadata { | ||
schemaVersion | ||
storedBlockIndex | ||
} | ||
} | ||
} | ||
"""; | ||
|
||
var result = await TestServices.ExecuteRequestAsync(serviceProvider, b => b.SetDocument(query)); | ||
|
||
await Verify(result); | ||
} | ||
} |
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