Bug 1959483 - Port tests from ExperimentFakes and ExperimentTestUtils to NimbusTestUtils in browser/components/genai r=nimbus-reviewers,firefox-ai-ml-reviewers,beth,Mardak

Differential Revision: https://phabricator.services.mozilla.com/D247008
This commit is contained in:
Daniel Thorn
2025-05-09 18:06:54 +00:00
committed by dthorn@mozilla.com
parent 221b7f2e3b
commit 5a6f848c38

View File

@@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
const { ExperimentFakes } = ChromeUtils.importESModule(
const { NimbusTestUtils } = ChromeUtils.importESModule(
"resource://testing-common/NimbusTestUtils.sys.mjs"
);
@@ -18,7 +18,7 @@ add_task(async function test_nimbus_user_prefs() {
"No user nimbus pref yet"
);
let cleanup = await ExperimentFakes.enrollWithFeatureConfig({
let cleanup = await NimbusTestUtils.enrollWithFeatureConfig({
featureId: "chatbot",
value: {
prefs: {
@@ -54,7 +54,7 @@ add_task(async function test_nimbus_user_prefs() {
"sidebar used default value"
);
cleanup = await ExperimentFakes.enrollWithFeatureConfig({
cleanup = await NimbusTestUtils.enrollWithFeatureConfig({
featureId: "chatbot",
value: {
prefs: {
@@ -92,7 +92,7 @@ add_task(async function test_nimbus_default_prefs() {
"sidebar used default value"
);
const cleanup = await ExperimentFakes.enrollWithFeatureConfig({
const cleanup = await NimbusTestUtils.enrollWithFeatureConfig({
featureId: "chatbot",
value: {
prefs: {
@@ -118,7 +118,7 @@ add_task(async function test_nimbus_default_prefs() {
add_task(async function test_nimbus_rollout_experiment() {
const foo = "browser.ml.chat.foo";
const nimbus = "browser.ml.chat.nimbus";
const cleanRollout = await ExperimentFakes.enrollWithFeatureConfig(
const cleanRollout = await NimbusTestUtils.enrollWithFeatureConfig(
{
featureId: "chatbot",
value: {
@@ -138,7 +138,7 @@ add_task(async function test_nimbus_rollout_experiment() {
const nimbusValue = Services.prefs.getStringPref(nimbus);
Assert.ok(nimbusValue, "Set some nimbus slug");
const cleanExperiment = await ExperimentFakes.enrollWithFeatureConfig({
const cleanExperiment = await NimbusTestUtils.enrollWithFeatureConfig({
featureId: "chatbot",
value: {
prefs: {
@@ -170,7 +170,7 @@ add_task(async function test_nimbus_rollout_experiment() {
add_task(async function test_nimbus_minimum_version() {
const foo = "browser.ml.chat.foo";
const nimbus = "browser.ml.chat.nimbus";
let cleanup = await ExperimentFakes.enrollWithFeatureConfig({
let cleanup = await NimbusTestUtils.enrollWithFeatureConfig({
featureId: "chatbot",
value: {
minVersion: AppConstants.MOZ_APP_VERSION_DISPLAY + ".1",
@@ -188,7 +188,7 @@ add_task(async function test_nimbus_minimum_version() {
cleanup();
cleanup = await ExperimentFakes.enrollWithFeatureConfig({
cleanup = await NimbusTestUtils.enrollWithFeatureConfig({
featureId: "chatbot",
value: {
minVersion: AppConstants.MOZ_APP_VERSION_DISPLAY,