<commit_before>// Unit test the unread.js module, which depends on these global variables:
//
//   _, narrow_state, current_msg_list, home_msg_list, subs
//
// These tests are framework-free and run sequentially; they are invoked
// immediately after being defined.  The contract here is that tests should
// clean up after themselves, and they should explicitly stub all
// dependencies (except _).

add_dependencies({
    muting: 'js/muting.js',
    people: 'js/people.js',
    unread: 'js/unread.js',
});

var stream_data = require('js/stream_data.js');

set_global('stream_data', stream_data);
set_global('blueslip', {});
set_global('page_params', {});
set_global('feature_flags', {
    load_server_counts: true,
});

var Dict = global.Dict;
var muting = global.muting;
var people = global.people;

var unread = require('js/unread.js');

var narrow_state = {};
global.narrow_state = narrow_state;

var current_msg_list = {};
global.current_msg_list = current_msg_list;

var home_msg_list = {};
global.home_msg_list = home_msg_list;

var me = {
    email: '<EMAIL>',
    user_id: 30,
    full_name: '<NAME>',
};
people.add(me);
people.initialize_current_user(me.user_id);

var zero_counts = {
    private_message_count: 0,
    home_unread_messages: 0,
    mentioned_message_count: 0,
    stream_count: new Dict(),
    topic_count: new Dict(),
    pm_count: new Dict(),
};<commit_msg>node tests: Use zrequire in unread.js.<commit_after>zrequire('muting');
zrequire('people');
zrequire('stream_data');
zrequire('unread');

set_global('blueslip', {});
set_global('page_params', {});
set_global('feature_flags', {
    load_server_counts: true,
});
set_global('narrow_state', {});
set_global('current_msg_list', {});
set_global('home_msg_list', {});

var me = {
    email: '<EMAIL>',
    user_id: 30,
    full_name: '<NAME>',
};
people.add(me);
people.initialize_current_user(me.user_id);

var zero_counts = {
    private_message_count: 0,
    home_unread_messages: 0,
    mentioned_message_count: 0,
    stream_count: new Dict(),
    topic_count: new Dict(),
    pm_count: new Dict(),
};
{'fraction_non_alphanumeric': 0.1476510067114094, 'fraction_numerical': 0.004793863854266539, 'mean_word_length': 4.813370473537605, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '5090055', 'n_tokens_mistral': 732, 'n_tokens_neox': 721, 'n_words': 161}