<commit_before>/*!
 * Copyright 2014 Digital Services, University of Cambridge Licensed
 * under the Educational Community License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the
 * License. You may obtain a copy of the License at
 *
 *     http://opensource.org/licenses/ECL-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an "AS IS"
 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */

require(['gh.core', 'gh.api.tests', 'sinon'], function(gh, testAPI, sinon) {
    module('Orgunit API');

    QUnit.test('init', function(assert) {
        assert.ok(true);
    });

    // Test the getOrgUnits functionality

    // Test the getOrgUnitsByApp functionality

    // Test the getOrgUnit functionality

    // Test the getOrgUnitSeries functionality

    // Test the getOrgUnitCalendar functionality

    // Test the getOrgUnitCalendarIcal functionality

    // Test the getOrgUnitCalendarRss functionality

    // Test the getOrgUnitUpcoming functionality

    // Test the createOrgUnit functionality

    // Test the createOrgUnitByApp functionality

    // Test the updateOrgUnit functionality

    // Test the addOrgUnitSeries functionality<commit_msg>Add qunit test for getting organisational units<commit_after>/*!
 * Copyright 2014 Digital Services, University of Cambridge Licensed
 * under the Educational Community License, Version 2.0 (the
 * "License"); you may not use this file except in compliance with the
 * License. You may obtain a copy of the License at
 *
 *     http://opensource.org/licenses/ECL-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an "AS IS"
 * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing
 * permissions and limitations under the License.
 */

require(['gh.core', 'gh.api.tests', 'sinon'], function(gh, testAPI, sinon) {
    module('Orgunit API');

    QUnit.test('init', function(assert) {
        assert.ok(true);
    });

    // Test the getOrgUnits functionality
    QUnit.asyncTest('getOrgUnits', function(assert) {
        expect(7);

        // Verify that an error is thrown when no callback was provided
        assert.throws(function() {
            gh.api.orgunitAPI.getOrgUnits();
        }, 'Verify that an error is thrown when no callback was provided');

        // Verify that an error is thrown when an invalid callback was provided
        assert.throws(function() {
            gh.api.orgunitAPI.getOrgUnits(1, null, null, null, 'not_a_callback');
        }, 'Verify that an error is thrown when an invalid callback was provided');

        // Verify that an error is thrown when no appId was provided
        gh.api.orgunitAPI.getOrgUnits(null, null, null, null, function(err, data) {
            assert.ok(err, 'Verify that an error is thrown when no app id was provided');

            // Verify that an error is thrown when an invalid appId was provided
            gh.api.orgunitAPI.getOrgUnits('invalid_appid', null, null, null, function(err, data) {
                assert.ok(err, 'Verify that an error is thrown when an invalid app id was provided');

                // Verify that an error is thrown when no parentId was provided
                gh.api.orgunitAPI.getOrgUnits(1, null, 'invalid_parentid', null, function(err, data) {
                    assert.ok(err, 'Verify that an error is thrown when an invalid parent id was provided');

                    // Verify that an error is thrown when an invalid type was provided
                    gh.api.orgunitAPI.getOrgUnits(1, null, 1, 123, function(err, data) {
                        assert.ok(err, 'Verify that an error is thrown when an invalid type was provided');

                        // Verify that organisational units can be successfully retrieved
                        gh.api.orgunitAPI.getOrgUnits(1, false, null, null, function(err, data) {
                            assert.ok(!err, 'Verify that organistation units can be successfully retrieved');
                            QUnit.start();
                        });
                    });
                });
            });
        });
    });

    // Test the getOrgUnitsByApp functionality

    // Test the getOrgUnit functionality

    // Test the getOrgUnitSeries functionality

    // Test the getOrgUnitCalendar functionality

    // Test the getOrgUnitCalendarIcal functionality

    // Test the getOrgUnitCalendarRss functionality

    // Test the getOrgUnitUpcoming functionality

    // Test the createOrgUnit functionality

    // Test the createOrgUnitByApp functionality

    // Test the updateOrgUnit functionality

    // Test the addOrgUnitSeries functionality
{'fraction_non_alphanumeric': 0.08047124600638977, 'fraction_numerical': 0.0049920127795527154, 'mean_word_length': 2.656204379562044, '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': '1194810', 'n_tokens_mistral': 1295, 'n_tokens_neox': 1216, 'n_words': 502}