<commit_before>/* global describe:true it:true */
/* eslint-disable prefer-arrow-callback */

import { expect } from 'chai';
import Point from './Point';

const orderlyPayload = { x: 2, y: 1, z: 2 };
const dimensionKeys = [ 'x', 'y', 'z' ];
const fancyPayload = { halfX: 1, doubleY: 2 };
const mixedPayload = { halfX: 1, y: 2 };
const id = "Pointy McPointface";

describe('Types: Point', function() {

  describe('Meta', function() {
    const p = new Point(id, orderlyPayload);
    it('gets copy of payload', function() {
      expect(p.payload).to.eql(orderlyPayload);
      const wontChangeProp = p.payload;
      wontChangeProp.x = null;
      expect(p.payload).to.eql(orderlyPayload);
    });
    it('gets id', function() {
      expect(p.id).to.eql(id);
    });
  });

  describe('Dimensions', function() {
    describe('Default dimensions', function() {
      const p = new Point(id, orderlyPayload);
      it('exposes default dimensions', function() {
        expect(p.x).to.equal(2);
      });
    });
  });
});

<commit_msg>Covered edge cases for dimensions getter<commit_after>/* global describe:true it:true */
/* eslint-disable prefer-arrow-callback */
/* eslint-disable max-nested-callbacks */
/* eslint-disable no-unused-expressions */

import { expect } from 'chai';
import Point from './Point';

const orderlyPayload = { x: 2, z: 2 };
const dimensionKeys = [ 'x', 'y', 'z' ];
const fancyPayload = { halfX: 1, doubleY: 2 };
const mixedPayload = { halfX: 1, y: 2 };
const id = "Pointy McPointface";

describe('Types: Point', function() {

  describe('Meta', function() {
    const p = new Point(id, orderlyPayload);
    it('gets copy of payload', function() {
      expect(p.payload).to.eql(orderlyPayload);
      const wontChangeProp = p.payload;
      wontChangeProp.x = null;
      expect(p.payload).to.eql(orderlyPayload);
    });
    it('gets id', function() {
      expect(p.id).to.eql(id);
    });
  });

  describe('Dimension getters', function() {
    describe('Default dimensions', function() {
      const p = new Point(id, orderlyPayload);
      it('exposes default dimensions', function() {
        expect(p.x).to.equal(2);
        expect(p.z).to.equal(2);
      });
      it('returns undefined if dimension is not present in payload', function() {
        expect(p.y).to.be.undefined;
      });
      it('throws when trying to access prop not present in dimensions', function() {
        expect(p.w).to.throw;
      });
    });
  });
});


{'fraction_non_alphanumeric': 0.1705834683954619, 'fraction_numerical': 0.006482982171799027, 'mean_word_length': 3.1776649746192893, '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': '1601994', 'n_tokens_mistral': 802, 'n_tokens_neox': 776, 'n_words': 200}