Skip to content

Commit

Permalink
add 0% test
Browse files Browse the repository at this point in the history
  • Loading branch information
Jakeii committed Dec 4, 2024
1 parent 1615451 commit 82d946c
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 3 deletions.
4 changes: 4 additions & 0 deletions common/app/common/configuration.scala
Original file line number Diff line number Diff line change
Expand Up @@ -521,6 +521,10 @@ class GuardianConfiguration extends GuLogging {
lazy val prebidServerUrl =
configuration.getStringProperty("commercial.prebid.server.url") getOrElse "http://localhost:8000"

lazy val overrideCommercialBundleUrl: Option[String] =
if (environment.isDev) configuration.getStringProperty("commercial.overrideCommercialBundleUrl")
else None

def getBundlePath = configuration.getMandatoryStringProperty("commercial.bundlePath")
}

Expand Down
10 changes: 10 additions & 0 deletions common/app/experiments/Experiments.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ object ActiveExperiments extends ExperimentsDefinition {
override val allExperiments: Set[Experiment] =
Set(
EuropeBetaFront,
CommercialBundleUpdater,
DarkModeWeb,
)
implicit val canCheckExperiment: CanCheckExperiment = new CanCheckExperiment(this)
Expand All @@ -38,3 +39,12 @@ object DarkModeWeb
sellByDate = LocalDate.of(2025, 1, 30),
participationGroup = Perc0D,
)

object CommercialBundleUpdater
extends Experiment(
name = "commercial-bundle-updater",
description = "Enable the commercial bundle updater",
owners = Seq(Owner.withGithub("jakeii")),
sellByDate = LocalDate.of(2025, 1, 30),
participationGroup = Perc0B,
)
12 changes: 9 additions & 3 deletions common/app/views/support/JavaScriptPage.scala
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import model.dotcomrendering.DotcomRenderingUtils.assetURL
import play.api.mvc.RequestHeader
import views.support.Commercial.isAdFree
import common.CommercialBundle
import experiments.{ActiveExperiments, CommercialBundleUpdater}

object JavaScriptPage {

Expand Down Expand Up @@ -71,9 +72,14 @@ object JavaScriptPage {

val ipsos = if (page.metadata.isFront) getScriptTag(page.metadata.id) else getScriptTag(page.metadata.sectionId)

def commercialBundleUrl = JsString(
CommercialBundle.getBundleUrl,
)
val commercialBundleUrl =
if (ActiveExperiments.isParticipating(CommercialBundleUpdater)(request))
JsString(CommercialBundle.getBundleUrl)
else
JsString(
Configuration.commercial.overrideCommercialBundleUrl
.getOrElse(assetURL("javascripts/commercial/graun.standalone.commercial.js")),
)

javascriptConfig ++ config ++ commercialMetaData ++ journalismMetaData ++ Map(
("edition", JsString(edition.id)),
Expand Down

0 comments on commit 82d946c

Please sign in to comment.