Skip to content

Commit

Permalink
chapter 02: adding setup to the test
Browse files Browse the repository at this point in the history
  • Loading branch information
devcorpio committed Jan 9, 2019
1 parent aaa3ecf commit bb97e1e
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions chapter_02-a-first-unit-test/LogAn/logAnalyzer.test.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
const logAnalyzer = require('./logAnalyzer')();
const logAnalyzer = require('./logAnalyzer');

describe.each([
['johndoe.js', false],
['johndoe.slf', true],
['johndoe.SLF', true],
])('isValidLogFileName("%s"))', (fileName, expected) => {
let logAnalyzerInstance;
beforeEach(() => {
logAnalyzerInstance = logAnalyzer();
});

it(`bad extension returns ${expected}`, () => {
const result = logAnalyzer.isValidLogFileName(fileName);
const result = logAnalyzerInstance.isValidLogFileName(fileName);
expect(result).toBe(expected);
});
});

0 comments on commit bb97e1e

Please sign in to comment.