Skip to content
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/nice-buttons-happen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@mermaidchart/sdk': patch
---

Added analyticsID, avatarUrl, mermaidTheme, and mermaidLook to MCUser.
Comment thread
Prashant-7718 marked this conversation as resolved.
Outdated
2 changes: 2 additions & 0 deletions packages/cli/src/commander.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,8 @@ beforeAll(async () => {
const mockedMCUser = {
fullName: 'My Test User',
emailAddress: 'my-test-user@test.invalid',
analyticsID: '00000000-0000-0000-0000-0000000000aa',
avatarUrl: null,
} as const satisfies MCUser;
const mockedProjects = [
{
Expand Down
10 changes: 10 additions & 0 deletions packages/sdk/src/index.e2e.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,16 @@
const user = await client.getUser();

expect(user).toHaveProperty('emailAddress');
expect(user).toHaveProperty('analyticsID');
expect(typeof user.analyticsID).toBe('string');
expect(user.analyticsID.length).toBeGreaterThan(0);
expect(user.avatarUrl === null || typeof user.avatarUrl === 'string').toBe(true);
if (user.mermaidTheme !== undefined) {
expect(typeof user.mermaidTheme).toBe('string');
}
if (user.mermaidLook !== undefined) {
expect(typeof user.mermaidLook).toBe('string');
}
});
});

Expand Down Expand Up @@ -299,7 +309,7 @@

const creditsAfter = await client.getAICredits();
expect(creditsAfter.aiCredits.remaining).toBe(
creditsBefore.aiCredits.remaining - result.creditUsage!.creditsToDeduct,

Check warning on line 312 in packages/sdk/src/index.e2e.test.ts

View workflow job for this annotation

GitHub Actions / test (22.x, sdk, macos-latest)

Forbidden non-null assertion
);
}
} catch (error) {
Expand Down
2 changes: 2 additions & 0 deletions packages/sdk/src/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ describe('MermaidChart', () => {
return {
fullName: 'Test User',
emailAddress: 'test@invalid.invalid',
analyticsID: '00000000-0000-0000-0000-0000000000aa',
avatarUrl: null,
};
});
});
Expand Down
4 changes: 4 additions & 0 deletions packages/sdk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export interface AuthState {
export interface MCUser {
fullName: string;
emailAddress: string;
analyticsID: string;
avatarUrl: string | null;
mermaidTheme?: string;
mermaidLook?: string;
}
Comment thread
Copilot marked this conversation as resolved.

export interface AICreditsUsage {
Expand Down
Loading