@@ -2,7 +2,6 @@ import { http, HttpResponse } from "msw";
22import { afterEach , beforeEach , describe , expect , it , vi } from "vitest" ;
33
44import { ReflagClient } from "../src/client" ;
5- import { CompanyContext , ContextValue , UserContext } from "../src/context" ;
65import { FlagsClient } from "../src/flag/flags" ;
76import { HttpClient } from "../src/httpClient" ;
87import { deferred } from "./deferred" ;
@@ -67,37 +66,6 @@ describe("ReflagClient", () => {
6766 vi . unstubAllGlobals ( ) ;
6867 } ) ;
6968
70- it ( "accepts JSON-compatible values in user, company and other context updates" , async ( ) => {
71- const user : UserContext = {
72- id : "user1" ,
73- enabled : true ,
74- tags : [ "beta" , 1 , null ] ,
75- preferences : { theme : "dark" , omitted : undefined } ,
76- cleared : null ,
77- } ;
78- const company : CompanyContext = {
79- id : "company1" ,
80- enterprise : false ,
81- settings : { regions : [ "eu" , "us" ] } ,
82- } ;
83- const other : Record < string , ContextValue > = {
84- preview : true ,
85- settings : { locale : "en" } ,
86- } ;
87-
88- await client . updateUser ( user ) ;
89- await client . updateCompany ( company ) ;
90- await client . updateOtherContext ( other ) ;
91- await client . updateUser ( { enabled : false } ) ;
92-
93- expect ( client . getContext ( ) ) . toEqual ( {
94- user : { ...user , enabled : false } ,
95- company,
96- other,
97- } ) ;
98- expect ( flagClientSetContext ) . toHaveBeenLastCalledWith ( client . getContext ( ) ) ;
99- } ) ;
100-
10169 describe ( "updateUser" , ( ) => {
10270 it ( "should update the user context" , async ( ) => {
10371 // and send new user data and trigger flag update
0 commit comments