<commit_before>'use strict';

const expect = require('chai').expect;
const Reminisce = require('../');

describe('plugin', () => {
  const memories = [
    { key: 'test1', val: 1, ttl: 10000 },
    { key: 'test2', val: 2 }
  ];
  let cache;

  beforeEach(() => {
    cache = new Reminisce({
      memories,
      options: { ttl: 60000, interval: 30000 }
    });
  });

  describe('constructor', () => {
    it('should initialize with a single memory', () => {
      cache = new Reminisce({ memories: memories[0] });

      expect(cache).to.be.an('object');
    });

    it('should initialize with memories', () => {
      cache = new Reminisce({ memories });

      expect(cache).to.be.an('object');
    });

    it('should initialize without memories', () => {
      cache = new Reminisce();

      expect(cache).to.be.an('object');
    });

    it('should take options', () => {
      cache = new Reminisce({
        options: { ttl: 10000, interval: 60000 }
      });

      expect(cache).to.be.an('object');
    });
  });

  describe('get memories function', () => {
    it('get a single memory', () => {
      return cache.get('test1')
        .spread((m) => {
          expect(m).to.have.property('key', 'test1');<commit_msg>Reword constructor unit tests.<commit_after>'use strict';

const expect = require('chai').expect;
const Reminisce = require('../');

describe('plugin', () => {
  const memories = [
    { key: 'test1', val: 1, ttl: 10000 },
    { key: 'test2', val: 2 }
  ];
  let cache;

  beforeEach(() => {
    cache = new Reminisce({
      memories,
      options: { ttl: 60000, interval: 30000 }
    });
  });

  describe('constructor', () => {
    it('should initialize with a single memory', () => {
      cache = new Reminisce({ memories: memories[0] });

      expect(cache).to.be.an('object');
    });

    it('should initialize with multiple memories', () => {
      cache = new Reminisce({ memories });

      expect(cache).to.be.an('object');
    });

    it('should initialize with options', () => {
      cache = new Reminisce({
        options: { ttl: 10000, interval: 60000 }
      });

      expect(cache).to.be.an('object');
    });

    it('should initialize without memories or options', () => {
      cache = new Reminisce();

      expect(cache).to.be.an('object');
    });
  });

  describe('get memories function', () => {
    it('get a single memory', () => {
      return cache.get('test1')
        .spread((m) => {
          expect(m).to.have.property('key', 'test1');
{'fraction_non_alphanumeric': 0.19896331738437, 'fraction_numerical': 0.025518341307814992, 'mean_word_length': 2.630969609261939, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '452141', 'n_tokens_mistral': 844, 'n_tokens_neox': 772, 'n_words': 180}