Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ valueForAll val fb =
fb
& variations [Aeson.toJSON val]
& variationForAll (0 :: VariationIndex)
& offVariation (0 :: VariationIndex)

{-# DEPRECATED valueForAllUsers "Use valueForAll instead" #-}

Expand Down
18 changes: 18 additions & 0 deletions test/Spec/Integrations/TestData.hs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
, testTargeting
, testRules
, testValueForAll
, testValueForAllTargetingOff
]

testConfig :: DataSourceFactory -> Config
Expand Down Expand Up @@ -135,8 +136,8 @@
, toJSON ("red" :: Text)
, toJSON ("green" :: Text)
]
<&> TestData.variationForUser "ben" (0 :: TestData.VariationIndex)

Check warning on line 139 in test/Spec/Integrations/TestData.hs

View workflow job for this annotation

GitHub Actions / build-linux (lts-19.33, 9.0.2)

In the use of ‘variationForUser’

Check warning on line 139 in test/Spec/Integrations/TestData.hs

View workflow job for this annotation

GitHub Actions / build-linux (lts-18.28, 8.10.7)

In the use of ‘variationForUser’
<&> TestData.variationForUser "todd" (0 :: TestData.VariationIndex)

Check warning on line 140 in test/Spec/Integrations/TestData.hs

View workflow job for this annotation

GitHub Actions / build-linux (lts-19.33, 9.0.2)

In the use of ‘variationForUser’

Check warning on line 140 in test/Spec/Integrations/TestData.hs

View workflow job for this annotation

GitHub Actions / build-linux (lts-18.28, 8.10.7)

In the use of ‘variationForUser’
<&> TestData.variationForKey "org" "ben" (0 :: TestData.VariationIndex)
<&> TestData.offVariation (1 :: TestData.VariationIndex)
<&> TestData.fallthroughVariation (2 :: TestData.VariationIndex)
Expand Down Expand Up @@ -178,11 +179,11 @@
, toJSON ("red" :: Text)
, toJSON ("green" :: Text)
]
<&> TestData.ifMatch "country" [toJSON ("gb" :: Text), toJSON ("usa" :: Text)]

Check warning on line 182 in test/Spec/Integrations/TestData.hs

View workflow job for this annotation

GitHub Actions / build-linux (lts-19.33, 9.0.2)

In the use of ‘ifMatch’

Check warning on line 182 in test/Spec/Integrations/TestData.hs

View workflow job for this annotation

GitHub Actions / build-linux (lts-18.28, 8.10.7)

In the use of ‘ifMatch’
<&> TestData.andMatch "name" [toJSON ("Todd" :: Text)]

Check warning on line 183 in test/Spec/Integrations/TestData.hs

View workflow job for this annotation

GitHub Actions / build-linux (lts-19.33, 9.0.2)

In the use of ‘andMatch’

Check warning on line 183 in test/Spec/Integrations/TestData.hs

View workflow job for this annotation

GitHub Actions / build-linux (lts-18.28, 8.10.7)

In the use of ‘andMatch’
<&> TestData.thenReturn (1 :: TestData.VariationIndex)
<&> TestData.ifNotMatch "name" [toJSON ("Todd" :: Text)]

Check warning on line 185 in test/Spec/Integrations/TestData.hs

View workflow job for this annotation

GitHub Actions / build-linux (lts-19.33, 9.0.2)

In the use of ‘ifNotMatch’

Check warning on line 185 in test/Spec/Integrations/TestData.hs

View workflow job for this annotation

GitHub Actions / build-linux (lts-18.28, 8.10.7)

In the use of ‘ifNotMatch’
<&> TestData.andMatch "country" [toJSON ("gb" :: Text), toJSON ("usa" :: Text)]

Check warning on line 186 in test/Spec/Integrations/TestData.hs

View workflow job for this annotation

GitHub Actions / build-linux (lts-19.33, 9.0.2)

In the use of ‘andMatch’

Check warning on line 186 in test/Spec/Integrations/TestData.hs

View workflow job for this annotation

GitHub Actions / build-linux (lts-18.28, 8.10.7)

In the use of ‘andMatch’
<&> TestData.thenReturn (2 :: TestData.VariationIndex)
<&> TestData.fallthroughVariation (0 :: TestData.VariationIndex)
)
Expand Down Expand Up @@ -227,3 +228,20 @@
assertEqual "todd receives CustomType1" "CustomType1" =<< stringVariation client "flag-key-1" todd "CustomType2"

close client

testValueForAllTargetingOff :: Test
testValueForAllTargetingOff = TestCase $ do
td <- TestData.newTestData
TestData.update td
=<< ( TestData.flag td "flag-key-1"
<&> TestData.valueForAll ("value" :: Text)
<&> TestData.on False
)
let config = testConfig (TestData.dataSourceFactory td)
user = makeContext "user" "user"

client <- makeClient config

assertEqual "user receives value with targeting off" "value" =<< stringVariation client "flag-key-1" user "default"

close client
Loading