<commit_before>"use strict";
describe("Purchase test", function () {
  it("check data constraints", function () {
    //Purchases.insert({"id": 1, "title": "Gucci", "description": "Go Bears", "creator": 42, "members": [{"venmo_id": 42, "vote_status": 0}, {"venmo_id": 34, "vote_status": 1}], "cost": 24, "created_at": 10024});
    
    var purchase = Purchases.find({"id" : 1})["collection"]["_docs"]["_map"]["ge3tGQZ97TFpy9XX9"] //hacky

    expect(purchase["title"]).toBe("Gucci");
    expect(purchase["title"].length).toBeLessThan(64);
  });
});<commit_msg>Tests for checking purchase fields<commit_after>"use strict";
describe("Purchase test", function () {
  var myDatabase = Purchases;
  afterAll(function () {
    myDatabase.remove({"_id": "1"});
  });

  it("check data constraints, no error", function () {
    var entry = {"_id": "1", "title": "Gucci", "description": "Go Bears", "creator": 42, "members": [32], "accepted": [], "rejected": [], "member_names": {32: "Joe"}, "paid": [], "cost": 24, "created_at": 10024};
    if (Meteor.call("check_purchase", entry) == null) {
      myDatabase.insert(entry);
      var purchase = myDatabase.find({"_id" : "1"}).collection._docs._map["1"];
      expect(purchase.title).toBe("Gucci");
      expect(purchase.title.length).toBeLessThan(64);
    }
    expect(Meteor.call("check_purchase", entry)).toBeUndefined();
  });

  it("check data constraints, title too short", function () {
    var entry = {"_id": "1", "title": "", "description": "Go Bears", "creator": 42, "members": [32], "accepted": [], "rejected": [], "member_names": {32: "Joe"}, "paid": [], "cost": 24, "created_at": 10024};
    expect(Meteor.call("check_purchase", entry)).not.toBeNull();
  });
});
{'fraction_non_alphanumeric': 0.23457508731082655, 'fraction_numerical': 0.03317811408614668, 'mean_word_length': 5.139285714285714, 'pattern_counts': {'":': 34, '<': 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': '6976692', 'n_tokens_mistral': 631, 'n_tokens_neox': 574, 'n_words': 126}