Skip to content

Commit

Permalink
feat: Add roles attribute to Account
Browse files Browse the repository at this point in the history
  • Loading branch information
neet committed Feb 4, 2023
1 parent 392cee4 commit 7e04944
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/mastodon/v1/entities/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ export interface Account {
fields?: AccountField[] | null;
/** Boolean to indicate that the account performs automated actions */
bot?: boolean | null;
/** Roles that have been granted to this account. */
roles: Pick<Role, 'id' | 'name' | 'color'>[]; // TODO: Create an entity when documentation is updated
}

/**
Expand Down
4 changes: 2 additions & 2 deletions test-utils/jest-global-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const createApp = async (): Promise<mastodon.v1.Application> => {
const app = await masto.v1.apps.create({
clientName: 'Masto.js',
redirectUris: 'urn:ietf:wg:oauth:2.0:oob',
scopes: `read write follow push`,
scopes: 'read write follow push admin:read admin:write',
});
return app;
};
Expand All @@ -24,7 +24,7 @@ const createToken = async (
clientSecret: app.clientSecret!,
username: 'admin@localhost:3000',
password: 'mastodonadmin',
scope: 'read write follow push',
scope: 'read write follow push admin:read admin:write',
});
return token;
};
Expand Down
7 changes: 7 additions & 0 deletions tests/v1/admin/accounts.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
describe('account', () => {
it('fetches an account', async () => {
const me = await admin.v1.accounts.verifyCredentials();
const account = await admin.v1.admin.accounts.fetch(me.id);
expect(account.id).toBe(me.id);
});
});

0 comments on commit 7e04944

Please sign in to comment.