<commit_before>goog.module('measurementLibrary.storage.CookiesStorage.testing.findAutoDomain_');
goog.setTestOnly();

const CookiesStorage = goog.require('measurementLibrary.storage.CookiesStorage');

describe('the findAutoDomain method', () => {
  let testDocument;
  let setupDocument;
  const storage = new CookiesStorage({});

  beforeEach(() => {
    // sets up testDocument, an object that acts like the window.document object
    // when dealing with cookies with a specified domain. Allows for testing on
    // multiple domains.
    setupDocument = (domain, registrableDomain) => {
      testDocument = {'cook': ''};
      testDocument['domain'] = domain;
      Object.defineProperty(testDocument, 'cookie', {
        get() {
          return testDocument.cook;
        },
        set(newValue) {
          if (newValue.includes(`domain=${registrableDomain}`)) {
            testDocument.cook = newValue;
          }
        },
        configurable: true,
      });
    };
  });

  it('returns null when domain is a public suffix', () => {
    setupDocument('com');

    expect(storage.findAutoDomain_(testDocument)).toBe(null);<commit_msg>Update findAutoDomain_test.js<commit_after>goog.module('measurementLibrary.storage.CookiesStorage.testing.findAutoDomain_');
goog.setTestOnly();

const CookiesStorage = goog.require('measurementLibrary.storage.CookiesStorage');

describe('The findAutoDomain method', () => {
  let testDocument;
  let setupDocument;
  const storage = new CookiesStorage({});

  beforeEach(() => {
    // sets up testDocument, an object that acts like the window.document object
    // when dealing with cookies with a specified domain. Allows for testing on
    // multiple domains.
    setupDocument = (domain, registrableDomain) => {
      testDocument = {'cook': ''};
      testDocument['domain'] = domain;
      Object.defineProperty(testDocument, 'cookie', {
        get() {
          return testDocument.cook;
        },
        set(newValue) {
          if (newValue.includes(`domain=${registrableDomain}`)) {
            testDocument.cook = newValue;
          }
        },
        configurable: true,
      });
    };
  });

  it('returns null when domain is a public suffix', () => {
    setupDocument('com');

    expect(storage.findAutoDomain_(testDocument)).toBe(null);
{'fraction_non_alphanumeric': 0.12921348314606743, 'fraction_numerical': 0.0, 'mean_word_length': 3.18625678119349, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 11, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5803068', 'n_tokens_mistral': 630, 'n_tokens_neox': 615, 'n_words': 142}