-
Notifications
You must be signed in to change notification settings - Fork 285
Expand file tree
/
Copy pathpartial-mocks.ts
More file actions
35 lines (31 loc) · 1.04 KB
/
partial-mocks.ts
File metadata and controls
35 lines (31 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import { Constants } from '../constants';
import type { Hostname, Link } from '../types';
import type { Notification, Repository, Subject, User } from '../typesGitHub';
import { mockGitifyUser, mockToken } from './state-mocks';
export function partialMockNotification(
subject: Partial<Subject>,
repository?: Partial<Repository>,
): Notification {
const mockNotification: Partial<Notification> = {
account: {
method: 'Personal Access Token',
platform: 'GitHub Cloud',
hostname: Constants.GITHUB_API_BASE_URL as Hostname,
token: mockToken,
user: mockGitifyUser,
hasRequiredScopes: true,
},
subject: subject as Subject,
repository: repository as Repository,
};
return mockNotification as Notification;
}
export function partialMockUser(login: string): User {
const mockUser: Partial<User> = {
login: login,
html_url: `https://github.com/${login}` as Link,
avatar_url: 'https://avatars.githubusercontent.com/u/583231?v=4' as Link,
type: 'User',
};
return mockUser as User;
}