Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
"the document should have $yetify" : function (body) {
assert.isString(body);
var cachebuster = server.getCachebuster();
var injection = "";
assert.include(body, injection);
// injection appears at the end:
var idx = body.indexOf(injection);
assert.equal(
idx + injection.length,
body.length
);
}
},
"the correct headers are returned": function (server) {
assert.include(server.res.headers, "Content-Length");
assert.include(server.res.headers, "Content-Type");
assert.include(server.res.headers, "Expires");
assert.include(server.res.headers, "Date");
},
"no script is injected": function (server) {
"results look right": function(err, note, act) {
assert.ifError(err);
assert.isObject(note);
assert.include(note, "id");
assert.isString(note.id);
assert.include(note, "published");
assert.isString(note.published);
assert.include(note, "updated");
assert.isString(note.updated);
assert.include(note, "author");
assert.isObject(note.author);
assert.include(note.author, "id");
assert.isString(note.author.id);
assert.include(note.author, "displayName");
assert.isString(note.author.displayName);
assert.include(note.author, "objectType");
assert.isString(note.author.objectType);
},
"results don't leak private members": function(err, note, act) {
"by giving a valid install instance" : function(svcMetaInfo) {
assert.include(svcMetaInfo, "id");
},
"and by service map says it is installed" : function(svcMetaInfo) {
"it includes the activity": function(err, feed, act) {
assert.ifError(err);
assert.isObject(feed);
assert.isObject(act);
assert.include(feed, "items");
assert.isArray(feed.items);
assert.greater(feed.items.length, 0);
assert.isObject(_.find(feed.items, function(item) { return item.id === act.id; }));
}
}
"the stderr output contains the failing test details": function (topic) {
assert.include(topic.output, "testMoof");
assert.include(topic.output, "Values should be equal.");
assert.include(topic.output, "Expected: moof (string)");
assert.include(topic.output, "Actual: ? (string)");
assert.include(topic.output, "1 of 1 tests failed");
},
"the stderr output contains Agent complete": function (topic) {
"it includes our posted activity": function(err, feed, act) {
assert.ifError(err);
assert.isObject(feed);
assert.include(feed, "items");
assert.isArray(feed.items);
assert.greater(feed.items.length, 0);
assert.isTrue(_.some(feed.items, function(item) {
return (_.isObject(item) && item.id === act.id);
}));
}
}
assert.equal(serverOf(maven.following.url), "social.localhost");
assert.include(maven, "favorites");
assert.isObject(maven.favorites);
assert.include(maven.favorites, "url");
assert.equal(serverOf(maven.favorites.url), "social.localhost");
assert.include(maven, "lists");
assert.isObject(maven.lists);
assert.include(maven.lists, "url");
assert.equal(serverOf(maven.lists.url), "social.localhost");
assert.include(maven, "links");
assert.isObject(maven.links);
assert.include(maven.links, "self");
assert.isObject(maven.links.self);
assert.include(maven.links.self, "href");
assert.equal(serverOf(maven.links.self.href), "social.localhost");
assert.include(maven.links, "activity-inbox");
assert.isObject(maven.links["activity-inbox"]);
assert.include(maven.links["activity-inbox"], "href");
assert.equal(serverOf(maven.links["activity-inbox"].href), "social.localhost");
assert.include(maven.links, "self");
assert.isObject(maven.links["activity-outbox"]);
assert.include(maven.links["activity-outbox"], "href");
assert.equal(serverOf(maven.links["activity-outbox"].href), "social.localhost");
}
},
'should include host, path, and contentType as required':function(err){
assert.include(err.message, 'host')
assert.include(err.message, 'path')
assert.include(err.message, 'contentType')
}
},
assert.deepInclude = function (actual, expected, message) {
assertMissingArguments(arguments, assert.deepInclude);
if (!isArray(actual)) {
return assert.include(actual, expected, message);
}
if (!actual.some(function (item) { return utils.deepEqual(item, expected) })) {
assert.fail(actual, expected, message || "expected {actual} to include {expected}", "include", assert.deepInclude);
}
};
assert.deepIncludes = assert.deepInclude;