All files / Rindu/utils getValidCookieLocale.ts

50% Statements 4/8
0% Branches 0/3
0% Functions 0/1
57.14% Lines 4/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 1244x 44x 44x     2x            
import { LOCALE_COOKIE } from "./constants";
import { takeCookie } from "./cookies";
import { isLocale, Locale } from "./locale";
import { ServerApiContext } from "types/serverContext";
 
export function getValidCookieLocale(context: ServerApiContext): Locale | null {
  const localeCookie = takeCookie(LOCALE_COOKIE, context);
  Iif (localeCookie && isLocale(localeCookie)) return localeCookie;
 
  return null;
}