<commit_before>'use strict';

const path = require('path');
const tap = require('tap');
const fs = require('fs-extra');

const addPattern = require('../src/lib/addPattern');
const parseAllLinks = require('../src/lib/parseAllLinks');

const Pattern = require('../src/lib/object_factory').Pattern;
const PatternGraph = require('../src/lib/pattern_graph').PatternGraph;
const da = require('../src/lib/data_loader');
const dataLoader = new da();

const util = require('./util/test_utils.js');
const patterns_dir = './test/files/_patterns';

tap.test(
  'parseDataLinks - replaces found link.* data for their expanded links',
  function(test) {
    //arrange
    const patternlab = util.fakePatternLab(patterns_dir);
    patternlab.graph = PatternGraph.empty();

    patternlab.patterns = [
      Pattern.createEmpty({ patternPartial: 'twitter-brad' }, patternlab),
      Pattern.createEmpty({ patternPartial: 'twitter-dave' }, patternlab),
      Pattern.createEmpty({ patternPartial: 'twitter-brian' }, patternlab),
    ];
    patternlab.data.link = {};

    // copies essential logic from loadPattern
    const navPattern = new Pattern('00-test/nav.mustache');
    const patternData = dataLoader.loadDataFromFile(
      path.resolve(
        'test/files/_patterns',
        navPattern.subdir,
        navPattern.fileName
      ),
      fs
    );
    navPattern.jsonFileData = patternData;<commit_msg>fix(test): fix the test please and thank you<commit_after>'use strict';

const path = require('path');
const tap = require('tap');
const fs = require('fs-extra');

const addPattern = require('../src/lib/addPattern');
const parseAllLinks = require('../src/lib/parseAllLinks');

const Pattern = require('../src/lib/object_factory').Pattern;
const PatternGraph = require('../src/lib/pattern_graph').PatternGraph;
const da = require('../src/lib/data_loader');
const dataLoader = new da();

const util = require('./util/test_utils.js');
const patterns_dir = './test/files/_patterns';

tap.test(
  'parseDataLinks - replaces found link.* data for their expanded links',
  function(test) {
    //arrange
    const patternlab = util.fakePatternLab(patterns_dir);
    patternlab.graph = PatternGraph.empty();

    patternlab.patterns = [
      Pattern.createEmpty({ patternPartial: 'twitter-brad' }, patternlab),
      Pattern.createEmpty({ patternPartial: 'twitter-dave' }, patternlab),
      Pattern.createEmpty({ patternPartial: 'twitter-brian' }, patternlab),
    ];
    patternlab.data.link = {};

    // copies essential logic from loadPattern
    const navPattern = new Pattern('00-test/nav.mustache');
    const patternData = dataLoader.loadDataFromFile(
      path.resolve(
        __dirname,
        'files/_patterns',
        navPattern.subdir,
        navPattern.fileName
      ),
      fs
    );
    navPattern.jsonFileData = patternData;
{'fraction_non_alphanumeric': 0.14406481155336387, 'fraction_numerical': 0.0014089468122578373, 'mean_word_length': 3.7019867549668874, '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': '1874340', 'n_tokens_mistral': 824, 'n_tokens_neox': 810, 'n_words': 179}