<commit_before>require('chai').should()
expect = require("chai").expect
SandboxedModule = require('sandboxed-module')
modulePath = '../../../app/js/EventLogger'
sinon = require("sinon")
tk = require "timekeeper"

describe 'EventLogger', ->
	beforeEach ->
		@start = Date.now()
		tk.freeze(new Date(@start))
		@EventLogger = SandboxedModule.require modulePath, requires:
			"logger-sharelatex": @logger = {error: sinon.stub()}
			"metrics-sharelatex": @metrics = {inc: sinon.stub()}
		@channel = "applied-ops"
		@id_1 = "random-hostname:abc-1"
		@message_1 = "message-1"
		@id_2 = "random-hostname:abc-2"
		@message_2 = "message-2"

	afterEach ->
		tk.reset()

	describe 'checkEventOrder', ->

		describe 'when the events are in order', ->
			beforeEach ->
				@EventLogger.checkEventOrder(@channel, @id_1, @message_1)
				@status = @EventLogger.checkEventOrder(@channel, @id_2, @message_2)

			it 'should accept events in order', ->
				expect(@status).to.be.undefined<commit_msg>fix unit tests<commit_after>require('chai').should()
expect = require("chai").expect
SandboxedModule = require('sandboxed-module')
modulePath = '../../../app/js/EventLogger'
sinon = require("sinon")
tk = require "timekeeper"

describe 'EventLogger', ->
	beforeEach ->
		@start = Date.now()
		tk.freeze(new Date(@start))
		@EventLogger = SandboxedModule.require modulePath, requires:
			"logger-sharelatex": @logger = {error: sinon.stub(), warn: sinon.stub()}
			"metrics-sharelatex": @metrics = {inc: sinon.stub()}
		@channel = "applied-ops"
		@id_1 = "random-hostname:abc-1"
		@message_1 = "message-1"
		@id_2 = "random-hostname:abc-2"
		@message_2 = "message-2"

	afterEach ->
		tk.reset()

	describe 'checkEventOrder', ->

		describe 'when the events are in order', ->
			beforeEach ->
				@EventLogger.checkEventOrder(@channel, @id_1, @message_1)
				@status = @EventLogger.checkEventOrder(@channel, @id_2, @message_2)

			it 'should accept events in order', ->
				expect(@status).to.be.undefined
{'fraction_non_alphanumeric': 0.17213528520949015, 'fraction_numerical': 0.012115093387178193, 'mean_word_length': 4.385869565217392, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 17, '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': '2140480', 'n_tokens_mistral': 746, 'n_tokens_neox': 686, 'n_words': 137}