<commit_before>var assert = require('assert');
var sinon = require('sinon');
var async = require('async');
var support = require('../support');
var User = main.models.User;
var couchbase = main.couchbase.client(main.settings.couchbase.connection);

function assert_no_dangling_references(user, cb) {
    var username_key = User._make_key('username', user.username);
    var email_key = User._make_key('email', user.email);

    couchbase.get(username_key, function (err, result) {
        assert.ifError(err);
        assert.strictEqual(result, null);

        couchbase.get(email_key, function (err, result) {
            assert.ifError(err);
            assert.strictEqual(result, null);
            cb();
        });
    });
}

describe("User model", function () {
    var user_args;

    beforeEach(function () {
        user_args = {
            username: support.random.string(),
            email: support.random.email()
        };
    });

    describe("instantiating", function () {
        it("lets us set a username", function () {
            var user = new User(user_args);
            assert.strictEqual(user.username, user_args.username);
        });<commit_msg>testing that we can set an email<commit_after>var assert = require('assert');
var sinon = require('sinon');
var async = require('async');
var support = require('../support');
var User = main.models.User;
var couchbase = main.couchbase.client(main.settings.couchbase.connection);

function assert_no_dangling_references(user, cb) {
    var username_key = User._make_key('username', user.username);
    var email_key = User._make_key('email', user.email);

    couchbase.get(username_key, function (err, result) {
        assert.ifError(err);
        assert.strictEqual(result, null);

        couchbase.get(email_key, function (err, result) {
            assert.ifError(err);
            assert.strictEqual(result, null);
            cb();
        });
    });
}

describe("User model", function () {
    var user_args;

    beforeEach(function () {
        user_args = {
            username: support.random.string(),
            email: support.random.email()
        };
    });

    describe("instantiating", function () {
        it("lets us set a username and email", function () {
            var user = new User(user_args);
            assert.strictEqual(user.username, user_args.username);
            assert.strictEqual(user.email, user_args.email);
        });
{'fraction_non_alphanumeric': 0.13788870703764322, 'fraction_numerical': 0.0, 'mean_word_length': 2.796583850931677, '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': '5076560', 'n_tokens_mistral': 704, 'n_tokens_neox': 693, 'n_words': 148}