define([
    'bitbucket/internal/util/parse-commit-message'
], function(
    parseCommitMessage
) {

    'use strict';

    module('util-parse-commit-message');

    test('valid inputs', function () {
        // same test cases as the Java implementation in ParseCommitMessageFunctionTest.java
        deepEqual(parseCommitMessage.splitIntoSubjectAndBody("commit message without a new line or fullstops"), {subject: "commit message without a new line or fullstops", body: ""});
        deepEqual(parseCommitMessage.splitIntoSubjectAndBody("commit message. In two sentences"), {subject: "commit message.", body: "In two sentences"});
        deepEqual(parseCommitMessage.splitIntoSubjectAndBody("commit message with. sentences.\nthen a new line"), {subject: "commit message with. sentences.",  body: "then a new line"});
        deepEqual(parseCommitMessage.splitIntoSubjectAndBody("commit message\nwith a new line mid-sentence."), {subject: "commit message",  body: "with a new line mid-sentence."});
        deepEqual(parseCommitMessage.splitIntoSubjectAndBody("commit message\n\nwith. sentences."), {subject: "commit message", body: "with. sentences."});
        deepEqual(parseCommitMessage.splitIntoSubjectAndBody("commit message subject\nwith multiple\nnew lines\n\nThen the message body"), {subject: "commit message subject with multiple new lines", body: "Then the message body"});
        deepEqual(parseCommitMessage.splitIntoSubjectAndBody("commit message\n\nwith two new lines"), {subject: "commit message", body: "with two new lines"});
    });
});
