test(access-token): write model tests

This commit is contained in:
Ali BARIN
2024-10-01 09:56:46 +00:00
parent d35cf8d31e
commit 4db8683bd6
3 changed files with 133 additions and 7 deletions

View File

@@ -34,24 +34,25 @@ class AccessToken extends Base {
return;
}
const user = await this
.$relatedQuery('user');
const user = await this.$relatedQuery('user');
const firstIdentity = await user
.$relatedQuery('identities')
.first();
const firstIdentity = await user.$relatedQuery('identities').first();
const samlAuthProvider = await firstIdentity
.$relatedQuery('samlAuthProvider')
.throwIfNotFound();
const response = await samlAuthProvider.terminateRemoteSession(this.samlSessionId);
const response = await samlAuthProvider.terminateRemoteSession(
this.samlSessionId
);
return response;
}
async revoke() {
const response = await this.$query().patch({ revokedAt: new Date().toISOString() });
const response = await this.$query().patch({
revokedAt: new Date().toISOString(),
});
try {
await this.terminateRemoteSamlSession();