Javascript Type Error, is not a function

(function ($, window) {
    // BASE FUNCTION
    var test = function (selector, context) {
        return new test.fn.init(selector, context);
    };

    // SELECTOR FUNCTIONS
    test.fn = test.prototype = {
        constructor: test,
        init: function (selector, context) {
            // Use jQuery to build selector object
            this.selector = $(selector, context);
            return this;
        },

        // Create a popup dialog
        popup: function (options) {
            console.log('popup');
            return this;
        }
    };

    // Expose test to the global object
    window.test = test;
}(window.jQuery, window));

test.fn.init.prototype = test.fn;

You missed the constructor and the prototype chain on the created instances of test.