<commit_before>import {Items} from './collections';

Meteor.publish('transformations_items', function () {
    return Items.find();
});
Meteor.publish('transformations_items_custom', function () {
    return Items.find({}, {
        transform(doc) {
            doc.customServerTransform = true;
            return doc;
        }
    });
});

Meteor.methods({
    'transformations_boot'() {
        Items.remove({});
        Items.insert({title: 'hello1'});
    }
});<commit_msg>added server-side test for transformations and observeChanges<commit_after>import {Items} from './collections';

Meteor.publish('transformations_items', function () {
    return Items.find();
});
Meteor.publish('transformations_items_custom', function () {
    return Items.find({
        context: 'client',
    }, {
        transform(doc) {
            doc.customServerTransform = true;
            return doc;
        }
    });
});

Meteor.methods({
    'transformations_boot'() {
        Items.remove({});
        Items.insert({context: 'client', title: 'hello1'});
    }
});


describe('Transformations - Server Test', function () {
    it('Should transform properly', function (done) {
        const context = Random.id();
        const handle = Items.find({
            context,
        }).observeChanges({
            added(docId, doc) {
                assert.isTrue(doc.defaultServerTransform);
                handle.stop();
                done();
            }
        });

        Items.insert({context, title: 'hello2'});
    })
});
{'fraction_non_alphanumeric': 0.15344262295081967, 'fraction_numerical': 0.0019672131147540984, 'mean_word_length': 2.391111111111111, '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': '7639331', 'n_tokens_mistral': 437, 'n_tokens_neox': 413, 'n_words': 79}