Last active
February 3, 2022 15:13
-
-
Save to-mc/57779035717cf0909b97c28c1d34caff to your computer and use it in GitHub Desktop.
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
@pytest.mark.asyncio | |
async def test_resolver_async(): | |
# GIVEN | |
app = AppSyncResolver() | |
mock_event = {"typeName": "Customer", "fieldName": "field", "arguments": {}} | |
# Note: this function would be defined in another module in an actual serverless application, and imported. | |
# Its structured this way here as we're testing the framework itself. | |
@app.resolver(field_name="field") | |
async def get_async(): | |
await asyncio.sleep(0.0001) | |
return "value" | |
# WHEN | |
mock_context = LambdaContext() | |
result = await app.resolve(mock_event, mock_context) | |
# THEN | |
assert result == "value" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment