-
Notifications
You must be signed in to change notification settings - Fork 1
/
output.ts
82 lines (67 loc) · 2.4 KB
/
output.ts
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import * as fc from "fast-check";
export const getArbitraryQuery = (): fc.Arbitrary<any> =>
fc.record({
Tweet: getArbitraryTweet(),
Tweets: fc.array(getArbitraryTweet()),
TweetsMeta: getArbitraryMeta(),
User: getArbitraryUser(),
Notifications: fc.array(getArbitraryNotification()),
NotificationsMeta: getArbitraryMeta(),
});
export const getArbitraryID = (): fc.Arbitrary<any> => fc.string();
export const getArbitraryTweet = (): fc.Arbitrary<any> =>
fc.record({
id: getArbitraryID(),
body: getArbitraryString(),
date: getArbitraryDate(),
Author: getArbitraryUser(),
Stats: getArbitraryStat(),
});
export const getArbitraryString = (): fc.Arbitrary<any> => fc.string();
export const getArbitraryDate = (): fc.Arbitrary<any> => fc.string();
export const getArbitraryUser = (): fc.Arbitrary<any> =>
fc.record({
id: getArbitraryID(),
username: getArbitraryString(),
first_name: getArbitraryString(),
last_name: getArbitraryString(),
full_name: getArbitraryString(),
name: getArbitraryString(),
avatar_url: getArbitraryUrl(),
});
export const getArbitraryUrl = (): fc.Arbitrary<any> => fc.string();
export const getArbitraryStat = (): fc.Arbitrary<any> =>
fc.record({
views: getArbitraryInt(),
likes: getArbitraryInt(),
retweets: getArbitraryInt(),
responses: getArbitraryInt(),
});
export const getArbitraryInt = (): fc.Arbitrary<any> => fc.integer();
export const getArbitraryMeta = (): fc.Arbitrary<any> =>
fc.record({ count: getArbitraryInt() });
export const getArbitraryNotification = (): fc.Arbitrary<any> =>
fc.record({
id: getArbitraryID(),
date: getArbitraryDate(),
type: getArbitraryString(),
});
export const getArbitraryMutation = (): fc.Arbitrary<any> =>
fc.record({
createTweet: getArbitraryTweet(),
deleteTweet: getArbitraryTweet(),
markTweetRead: getArbitraryBoolean(),
});
export const getArbitraryBoolean = (): fc.Arbitrary<any> => fc.boolean();
export const getArbitraryActionExecutionCapabilitySetting = (): fc.Arbitrary<
any
> =>
fc.oneof(
fc.constant("ALL_ACTIONS"),
fc.constant("DISABLED"),
fc.constant("LOCAL_ACTIONS_ONLY"),
fc.constant("NO_POLICY")
);
export const getArbitraryAddCommentInput = (): fc.Arbitrary<any> => fc.string();
export const getArbitraryStatOrNotification = (): fc.Arbitrary<any> =>
fc.oneof(getArbitraryStat(), getArbitraryNotification());