<commit_before>'use strict';

const tap = require('tap');
const test = tap.test;
const beforeEach = tap.beforeEach;
const afterEach = tap.afterEach;
const teardown = tap.teardown;

const Store = require('../src/store');
const TransactionStoreAction = require('../src/actions/transaction-action');

/*
Setup.
*/

var store;

var initialState = {
	a: 1,
	b: 'b data',
	c: 'c'
};

var reducer1 = {
	a: function (state, action) {
		state.a = action.payload.updated;
		this.setState(state);
	}
};

var reducer2 = {
	b: function (state, action) {
		state.b = action.payload.updated;
		this.setState(state);
	}
};

var subscriber = function (state) {
	state.c = true;
};

// Call the supplied function before every subsequent descendent test.
beforeEach(function (done) {
	store = new Store(reducer1, initialState);

	done();
});

// Call the supplied function after every subsequent descendent test.
afterEach(function (done) {
	done();
});

// Run the supplied function when t.end() is called, or when the plan is met.
teardown(function () {});

test('.setState', function (t) {
	store.setState(null);
	t.equal(store.getState(), null, 'State object changed.');
	t.end();
});

test('.addSubscriber', function (t) {
	store.addSubscriber(subscriber);
<commit_msg>Tests.<commit_after>'use strict';

const tap = require('tap');
const test = tap.test;
const beforeEach = tap.beforeEach;
const afterEach = tap.afterEach;
const teardown = tap.teardown;

const Store = require('../src/store');
const TransactionStoreAction = require('../src/actions/transaction-action');

/*
Setup.
*/

var store;

var initialState;

var reducer1 = {
	a: function (state, action) {
		state.a = action.payload.updated;
		this.setState(state);
	}
};

var reducer2 = {
	b: function (state, action) {
		state.b = action.payload.updated;
		this.setState(state);
	}
};

var subscriber = function (state) {
	state.c = true;
};

// Call the supplied function before every subsequent descendent test.
beforeEach(function (done) {
	store = new Store(reducer1, initialState);
	initialState = {
		a: 1,
		b: 'b data',
		c: 'c'
	};

	done();
});

// Call the supplied function after every subsequent descendent test.
afterEach(function (done) {
	done();
});

// Run the supplied function when t.end() is called, or when the plan is met.
teardown(function () {});

test('.setState', function (t) {
	store.setState(null);
	t.equal(store.getState(), null, 'State object changed.');
	t.end();
});

test('.addSubscriber', function (t) {
	store.addSubscriber(subscriber);

{'fraction_non_alphanumeric': 0.15939730372720062, 'fraction_numerical': 0.0031720856463124504, 'mean_word_length': 4.212809917355372, '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': '5478376', 'n_tokens_mistral': 852, 'n_tokens_neox': 842, 'n_words': 233}