Created
August 4, 2024 20:17
-
-
Save colinfwren/4ed1179881a1c728ab5bb752e364d74e to your computer and use it in GitHub Desktop.
Reading values from Appwrite after test
This file contains hidden or 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
async function getRecordDetails(recId: String): Promise<Models.Doc> { | |
const client = new Client() | |
.setEndpoint(APPWRITE_URL) | |
.setProject(APPWRITE_PROJECT) | |
.setKey(APPWRITE_API_KEY) | |
const databases = new Databases(client) | |
return databases.getDocument(DATABASE_ID, COL_ID, recId) | |
} | |
test('that created thing has permissions', async () => { | |
const { user, jwt } = await getNewUser() | |
const recId = await someFunctionThatCreatesSomethingViaGraphQL() | |
const createdThing = await getRecordDetails(recId) | |
expect(createdTodo.$permissions).toMatchObject([ | |
`read("user:${user.$id}")`, | |
`update("user:${user.$id}")`, | |
`delete("user:${user.$id}")` | |
]) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment