<commit_before>var apn = require("../");
var sinon = require("sinon");

describe("Notification", function() {

	var note;
	beforeEach(function() {
		note = new apn.Notification();
	});

	describe("aps payload", function() {
		describe("getAlertText", function() {
			describe("plain alert string", function() {
				it("gets the alert text", function() {
					note.alert = "hello";

					expect(note.getAlertText()).to.equal("hello");
				});
			});

			describe("alert object", function() {
				it("gets the alert text", function() {
					note.alert = { "body": "hello" };

					expect(note.getAlertText()).to.equal("hello");
				});
			});
		});
	});

	describe("length", function() {
		it("returns the correct payload length", function() {
			note.alert = "length";
			expect(note.length()).to.equal(26);
		});

		describe("payload changes after first calculation", function() {
			beforeEach(function() {
				note.alert = "short";
				note.length();
			});

			it("returns the correct payload length", function() {
				note.alert = "longer";
				expect(note.length()).to.equal(26);
			});
		});
	});

	describe("compile", function() {
		var stub;
		beforeEach(function() {
			stub = sinon.stub(note, "toJSON");<commit_msg>More aps properties will be tested<commit_after>var apn = require("../");
var sinon = require("sinon");

describe("Notification", function() {

	var note;
	beforeEach(function() {
		note = new apn.Notification();
	});

	describe("aps payload", function() {
		describe("alert property", function() {

			describe("getAlertText", function() {
				describe("plain alert string", function() {
					it("gets the alert text", function() {
						note.alert = "hello";

						expect(note.getAlertText()).to.equal("hello");
					});
				});

				describe("alert object", function() {
					it("gets the alert text", function() {
						note.alert = { "body": "hello" };

						expect(note.getAlertText()).to.equal("hello");
					});
				});
			});
		});
	});

	describe("length", function() {
		it("returns the correct payload length", function() {
			note.alert = "length";
			expect(note.length()).to.equal(26);
		});

		describe("payload changes after first calculation", function() {
			beforeEach(function() {
				note.alert = "short";
				note.length();
			});

			it("returns the correct payload length", function() {
				note.alert = "longer";
				expect(note.length()).to.equal(26);
			});
		});
	});

	describe("compile", function() {
		var stub;
		beforeEach(function() {
			stub = sinon.stub(note, "toJSON");
{'fraction_non_alphanumeric': 0.1957379636937648, 'fraction_numerical': 0.0031570639305445935, 'mean_word_length': 3.5758122743682312, 'pattern_counts': {'":': 2, '<': 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': '4699247', 'n_tokens_mistral': 958, 'n_tokens_neox': 765, 'n_words': 169}