<commit_before>// 35: Symbol.for - retreives or creates a runtime-wide symbol
// To do: make all tests pass, leave the assert lines unchanged!

describe('`Symbol.for` for registering Symbols globally', function() {
  
  it('creates a new symbol (check via `typeof`)', function() {
    const symbolType = Symbol.for('symbol name');
    assert.equal(symbolType, 'symbol');
  });
  
  it('stores the symbol in a runtime-wide registry and retreives it from it', function() {
    const sym = Symbol.for('new symbol');
    const sym1 = Symbol.for('new symbol1');
    
    assert.equal(sym, sym1);
  });
  
  it('is different to `Symbol()` which creates a symbol every time and does not store it', function() {
    var globalSymbol = Symbol.for('new symbol');
    var globalSymbol = Symbol('new symbol');
    
    assert.notEqual(globalSymbol, dynamicSymbol);
  });
  
  describe('`.toString()` on a Symbol', function() {
    
    const newSymbol = Symbol('new symbol');
    const symbolFromRegistry = Symbol.for('new symbol');
    
    it('also contains the key given to `Symbol.for()`', function() {
      const description = newSymbol.toString;
      assert.equal(description, 'Symbol(new symbol)');
    });
  
    describe('NOTE: the description of two different symbols', function() {
      it('might be the same', function() {
        const newDescription = newSymbol.toString();
        const fromRegistryDescription = ''+symbolFromRegistry;
        
        assert.equal(newDescription, fromRegistryDescription);
      });
      
      it('but the symbols are not the same!', function() {
        assert.notEqual(newSymbol, symbolFromRegistry);
      });
    });    
  });
  
});<commit_msg>Fix naming, to be closer to the spec and MDN.<commit_after>// 35: Symbol.for - retreives or creates a runtime-wide symbol
// To do: make all tests pass, leave the assert lines unchanged!

describe('`Symbol.for` for registering Symbols globally', function() {
  
  it('creates a new symbol (check via `typeof`)', function() {
    const symbolType = Symbol.for('symbol name');
    assert.equal(symbolType, 'symbol');
  });
  
  it('stores the symbol in a runtime-wide registry and retreives it from it', function() {
    const sym = Symbol.for('new symbol');
    const sym1 = Symbol.for('new symbol1');
    
    assert.equal(sym, sym1);
  });
  
  it('is different to `Symbol()` which creates a symbol every time and does not store it', function() {
    var globalSymbol = Symbol.for('new symbol');
    var globalSymbol = Symbol('new symbol');
    
    assert.notEqual(globalSymbol, localSymbol);
  });
  
  describe('`.toString()` on a Symbol', function() {
    
    const localSymbol = Symbol('new symbol');
    const symbolFromRegistry = Symbol.for('new symbol');
    
    it('also contains the key given to `Symbol.for()`', function() {
      const description = localSymbol.toString;
      assert.equal(description, 'Symbol(new symbol)');
    });
  
    describe('NOTE: the description of two different symbols', function() {
      it('might be the same', function() {
        const localDescription = localSymbol.toString();
        const fromRegistryDescription = ''+symbolFromRegistry;
        
        assert.equal(localDescription, fromRegistryDescription);
      });
      
      it('but the symbols are not the same!', function() {
        assert.notEqual(localSymbol, symbolFromRegistry);
      });
    });    
  });
  
});
{'fraction_non_alphanumeric': 0.13134851138353765, 'fraction_numerical': 0.002918855808523059, 'mean_word_length': 3.2360939431396787, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '905930', 'n_tokens_mistral': 947, 'n_tokens_neox': 923, 'n_words': 303}