-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from danieljharvey/oh-shit
Totally fucking smashed it
- Loading branch information
Showing
14 changed files
with
8,567 additions
and
16 deletions.
There are no files selected for viewing
Empty file.
Large diffs are not rendered by default.
Oops, something went wrong.
Empty file.
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,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()); |
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
This file was deleted.
Oops, something went wrong.
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,5 @@ | ||
schema: ./test/github/github-schema.graphql | ||
# documents: './src/**/*.graphql' | ||
generates: | ||
./output/github/output.ts: | ||
- ./dist/src/index.js |
File renamed without changes.
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,16 @@ | ||
import * as generated from "../output/twitter/output"; | ||
import * as fc from "fast-check"; | ||
|
||
const items: any = { ...generated }; | ||
|
||
Object.keys(items).forEach((key: string) => { | ||
const func = items[key]; | ||
console.log(`---------------${key}-----------------`); | ||
const arb = (func as any)(); | ||
fc.assert( | ||
fc.property(arb, a => { | ||
console.log(a); | ||
return true; | ||
}) | ||
); | ||
}); |
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,5 @@ | ||
schema: ./test/twitter/twitter-schema.graphql | ||
# documents: './src/**/*.graphql' | ||
generates: | ||
./output/twitter/output.ts: | ||
- ./dist/src/index.js |
File renamed without changes.
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 |
---|---|---|
|
@@ -5935,7 +5935,7 @@ [email protected]: | |
resolved "https://registry.yarnpkg.com/ts-log/-/ts-log-2.1.4.tgz#063c5ad1cbab5d49d258d18015963489fb6fb59a" | ||
integrity sha512-P1EJSoyV+N3bR/IWFeAqXzKPZwHpnLY6j7j58mAvewHRipo+BQM2Y1f9Y9BjEQznKwgqqZm7H8iuixmssU7tYQ== | ||
|
||
ts-node@^8: | ||
ts-node@^8, ts-node@^8.8.1: | ||
version "8.8.1" | ||
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-8.8.1.tgz#7c4d3e9ed33aa703b64b28d7f9d194768be5064d" | ||
integrity sha512-10DE9ONho06QORKAaCBpPiFCdW+tZJuY/84tyypGtl6r+/C7Asq0dhqbRZURuUlLQtZxxDvT8eoj8cGW0ha6Bg== | ||
|