1
1
mirror of https://github.com/github/semantic.git synced 2025-01-03 13:02:37 +03:00

add fixtures for testing

This commit is contained in:
Patrick Thomson 2019-01-10 16:05:11 -05:00
parent d4e9ab09a9
commit 589524b21e
2 changed files with 36 additions and 2 deletions

View File

@ -1,7 +1,8 @@
{-# LANGUAGE DeriveAnyClass #-}
{-# LANGUAGE DeriveAnyClass, OverloadedLists #-}
module Data.GitHub.Event.Push
( RepositoryPush (..)
, dummyPush
) where
import Prologue
@ -20,6 +21,15 @@ data ChangedFile = ChangedFile
, filePreviousPath :: Text
} deriving (Eq, Show, Generic, Message, Named)
sampleChange :: ChangedFile
sampleChange = ChangedFile
{ filePreviousOID = Git.OID "0000000000000000000000000000000000000000"
, fileOID = Git.OID "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"
, fileChangeType = "A"
, filePath = "dummyfile"
, filePreviousPath = "/dev/null"
}
data RepositoryPush = RepositoryPush
{ pushRequestContext :: Nested RequestContext
, pushActor :: Nested User
@ -28,3 +38,13 @@ data RepositoryPush = RepositoryPush
, pushRef :: Text
, pushChangedFiles :: NestedVec ChangedFile
} deriving (Eq, Show, Generic, Message, Named)
samplePush :: RepositoryPush
samplePush = RepositoryPush
{ pushRequestContext = Nested Nothing
, pushActor = Nested (Just monalisa)
, pushBefore = Git.SHA "308cf87a25e096a71be8aba8bb53f5575a60c388"
, pushAfter = Git.SHA "d7d56aeb77d6b8434d2789b4b0b6b305dfce10a82"
, pushRef = "refs/heads/test-branch"
, pushChangedFiles = [sampleChange]
}Nested Nothing

View File

@ -3,6 +3,7 @@
module Data.GitHub.User
( User (..)
, SpamuraiClassification (..)
, monalisa
) where
import Prologue
@ -10,7 +11,7 @@ import Prologue
import Proto3.Suite
import Data.GitHub.Timestamp
import Data.GitHub.User.Type (Type)
import Data.GitHub.User.Type (Type (Bot))
import Data.GitHub.Spamurai
data User = User
@ -24,3 +25,16 @@ data User = User
, userSpamuraiCalculation :: SpamuraiClassification
, userAnalyticsTrackingId :: Text
} deriving (Eq, Show, Generic, Message, Named)
monalisa :: User
monalisa = User
{ userId = 11111
, userLogin = "monalisa"
, userType = Bot
, userBillingPlan = "medium"
, userSpammy = False
, userTimestamp = Nested Nothing
, userSuspended = False
, userSpamuraiCalculation = Hammy
, userAnalyticsTrackingId = "MACHHOMMY"
}