<commit_before>#!/usr/bin/env node
var suite = require('suite.js');
var o = require('./object-sugar');

// test schemas
var license = o.schema('License', {
    name: {type: String, unique: true}
});

var library = o.schema('Library', {
    name: {type: String, required: true},
    licenses: o.refs('License')
});

suite(o.get, [

], {async: true});

suite(o.create, [
    [license, {name: 'foobar'}], {name: 'foobar'},
    [license, {name: 'foobar'}], {error: 'name was not unique!'}, // XXX: trig err!
    [library, {name: 'gpl'}], {name: 'gpl'}
], {async: true});

suite(o.getAll, [

], {async: true});

suite(o.update, [

], {async: true});

suite(o['delete'], [

], {async: true});

suite(o.count, [

], {async: true});

suite(o.getMeta, [
    license, {name: {type: String, unique: true}},
    library, {
        name: {
            type: String, required: true
        },
        licenses: {
            type: 'reference'
        }
    }
]);
<commit_msg>Make test dbs not persistent<commit_after>#!/usr/bin/env node
var suite = require('suite.js');
var o = require('./object-sugar');

suite(o.get, [

], {async: true});

(function() {
    var li = license();

    suite(o.create, [
        [li, {name: 'foobar'}], {name: 'foobar'},
        [li, {name: 'foobar'}], {error: 'name was not unique!'}, // XXX: trig err!
        [library(), {name: 'gpl'}], {name: 'gpl'}
    ], {async: true});
})();

suite(o.getAll, [

], {async: true});

suite(o.update, [

], {async: true});

suite(o['delete'], [

], {async: true});

suite(o.count, [

], {async: true});

suite(o.getMeta, [
    license, {name: {type: String, unique: true}},
    library, {
        name: {
            type: String, required: true
        },
        licenses: {
            type: 'reference'
        }
    }
]);

// test schemas
function license() {
    return o.schema('License', {
        name: {type: String, unique: true}
    });
}

function library() {
    return o.schema('Library', {
        name: {type: String, required: true},
        licenses: o.refs('License')
    });
}
{'fraction_non_alphanumeric': 0.2206527033609352, 'fraction_numerical': 0.0, 'mean_word_length': 2.761904761904762, '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': '7266329', 'n_tokens_mistral': 741, 'n_tokens_neox': 727, 'n_words': 176}