Skip to content

Commit 8315fe8

Browse files
author
Shakeel Mohamed
committed
Update tests to pass with a default token
The incorrect index error will only happen if an token is locked down to a specific index(es).
1 parent 8c1bdca commit 8315fe8

File tree

1 file changed

+12
-20
lines changed

1 file changed

+12
-20
lines changed

test/test_send.js

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,12 @@ var noDataBody = {
4141
code: 5
4242
};
4343

44-
var incorrectIndexBody = {
45-
text: "Incorrect index",
46-
code: 7,
47-
"invalid-event-number": 1
48-
};
44+
// TODO: add a test that gets this response
45+
// var incorrectIndexBody = {
46+
// text: "Incorrect index",
47+
// code: 7,
48+
// "invalid-event-number": 1
49+
// };
4950

5051
// Backup console.log so we can restore it later
5152
var ___log = console.log;
@@ -269,8 +270,8 @@ describe("SplunkLogger send", function() {
269270
done();
270271
});
271272
});
272-
// TODO: test successfully sending to another index
273-
it("should error with valid token, sending to a different index", function(done) {
273+
// TODO: test unsuccessfully sending to another index with specific index token settings
274+
it("should succeed with valid token, sending to a different index", function(done) {
274275
var config = {
275276
token: configurationFile.token
276277
};
@@ -287,25 +288,16 @@ describe("SplunkLogger send", function() {
287288
}
288289
};
289290

290-
var run = false;
291-
292-
logger.error = function(err, errContext) {
293-
run = true;
294-
assert.ok(err);
295-
assert.strictEqual(err.message, incorrectIndexBody.text);
296-
assert.strictEqual(err.code, incorrectIndexBody.code);
297-
assert.ok(errContext);
298-
assert.strictEqual(errContext, context);
291+
logger.error = function() {
292+
assert.ok(false);
299293
};
300294

301295
logger.send(context, function(err, resp, body) {
302296
assert.ok(!err);
303-
assert.ok(run);
304297
assert.strictEqual(resp.headers["content-type"], "application/json; charset=UTF-8");
305298
assert.strictEqual(resp.body, body);
306-
assert.strictEqual(body.text, incorrectIndexBody.text);
307-
assert.strictEqual(body.code, incorrectIndexBody.code);
308-
assert.strictEqual(body["invalid-event-number"], incorrectIndexBody["invalid-event-number"]);
299+
assert.strictEqual(body.text, successBody.text);
300+
assert.strictEqual(body.code, successBody.code);
309301
done();
310302
});
311303
});

0 commit comments

Comments
 (0)