-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#271]: getAvatarImageByID updated for version2
- Loading branch information
1 parent
09b5a97
commit 19d8e45
Showing
8 changed files
with
46 additions
and
7 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export interface AvatarWithDetails { | ||
/** The content type of the avatar. Expected values include 'image/png', 'image/svg+xml', or any other valid MIME type. */ | ||
contentType: 'image/png' | 'image/svg+xml' | string; | ||
/** The binary representation of the avatar image. */ | ||
avatar: ArrayBuffer; | ||
} |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,6 @@ | ||
export interface AvatarWithDetails { | ||
/** The content type of the avatar. Expected values include 'image/png', 'image/svg+xml', or any other valid MIME type. */ | ||
contentType: 'image/png' | 'image/svg+xml' | string; | ||
/** The binary representation of the avatar image. */ | ||
avatar: ArrayBuffer; | ||
} |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import { Avatar } from '../../../src/version3/models'; | ||
import { getVersion2Client } from '../utils'; | ||
import test from 'ava'; | ||
|
||
const client = getVersion2Client(); | ||
|
||
let avatar: Avatar | undefined; | ||
|
||
test.serial('should get all system avatars', async t => { | ||
const systemAvatars = await client.avatars.getAllSystemAvatars({ type: 'project' }); | ||
|
||
avatar = systemAvatars.system?.[0]; | ||
|
||
t.truthy(!!avatar); | ||
}); | ||
|
||
test.serial('should return avatar image with contentType', async t => { | ||
const avatarWithDetails = await client.avatars.getAvatarImageByID({ id: avatar!.id, type: 'project' }); | ||
|
||
t.is(avatarWithDetails.contentType, 'image/svg+xml'); | ||
t.truthy(avatarWithDetails.avatar instanceof Uint8Array); | ||
}); |