Commit bf42b642 by Tomas Dvorak

continuous logging test does not require specific order of messages

parent 034a3a5b
......@@ -5,17 +5,17 @@ const test = new Tester('test', 'users');
const sampleData = require('./assets/SampleData');
const pattern = /^Found new key type "(.{1,})" type "(.{1,})"$/g;
const expectedLines = `
Found new key type "_id" type "ObjectId"
Found new key type "name" type "String"
Found new key type "someBinData" type "BinData-generic"
Found new key type "bio" type "String"
Found new key type "pets" type "String"
Found new key type "birthday" type "Date"
Found new key type "pets" type "Array"
Found new key type "pets.XX" type "String"
Found new key type "someWeirdLegacyKey" type "String"
`.trim();
const expectedLines = [
'Found new key type "_id" type "ObjectId"',
'Found new key type "name" type "String"',
'Found new key type "someBinData" type "BinData-generic"',
'Found new key type "bio" type "String"',
'Found new key type "pets" type "String"',
'Found new key type "birthday" type "Date"',
'Found new key type "pets" type "Array"',
'Found new key type "pets.XX" type "String"',
'Found new key type "someWeirdLegacyKey" type "String"'
];
......@@ -28,9 +28,12 @@ describe('Continuous logging', () => {
return test.runAnalysis({collection:'users', logKeysContinuously:true}).then(output => {
var filteredOutput = output
.split('\n')
.filter(line => line.match(pattern))
.join('\n');
assert.equal(filteredOutput, expectedLines);
.filter(line => line.match(pattern));
assert.equal(filteredOutput.length, expectedLines.length);
expectedLines.forEach(expectedLine => {
const found = filteredOutput.indexOf(expectedLine) > -1;
assert.ok(found, `Expected line '${expectedLine}' not found in Variety output`);
});
});
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment