Skip to content

Commit

Permalink
test: Make tests resilient between versions: no more annoying chores (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
tmcw committed Apr 11, 2018
1 parent 3a6aba8 commit 6bf3f97
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions __tests__/__snapshots__/bin.js.snap
Expand Up @@ -5,7 +5,7 @@ exports[`--config 1`] = `
<html>
<head>
<meta charset='utf-8' />
<title>documentation 6.0.0 | Documentation</title>
<title> | Documentation</title>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<link href='assets/bass.css' type='text/css' rel='stylesheet' />
<link href='assets/style.css' type='text/css' rel='stylesheet' />
Expand All @@ -17,7 +17,7 @@ exports[`--config 1`] = `
<div id='split-left' class='overflow-auto fs0 height-viewport-100'>
<div class='py1 px2'>
<h3 class='mb0 no-anchor'>documentation</h3>
<div class='mb1'><code>6.0.0</code></div>
<div class='mb1'><code>6.1.0</code></div>
<input
placeholder='Filter'
id='filter-input'
Expand Down
4 changes: 2 additions & 2 deletions __tests__/__snapshots__/test.js.snap
Expand Up @@ -827,7 +827,7 @@ exports[`html nested.input.js 1`] = `
<html>
<head>
<meta charset='utf-8' />
<title>documentation 6.0.0 | Documentation</title>
<title> | Documentation</title>
<meta name='viewport' content='width=device-width,initial-scale=1'>
<link href='assets/bass.css' type='text/css' rel='stylesheet' />
<link href='assets/style.css' type='text/css' rel='stylesheet' />
Expand All @@ -839,7 +839,7 @@ exports[`html nested.input.js 1`] = `
<div id='split-left' class='overflow-auto fs0 height-viewport-100'>
<div class='py1 px2'>
<h3 class='mb0 no-anchor'>documentation</h3>
<div class='mb1'><code>6.0.0</code></div>
<div class='mb1'><code>6.1.0</code></div>
<input
placeholder='Filter'
id='filter-input'
Expand Down
3 changes: 2 additions & 1 deletion __tests__/bin.js
Expand Up @@ -171,7 +171,8 @@ test('--config', async function() {
{},
false
);
const output = fs.readFileSync(outputIndex, 'utf8');
let output = fs.readFileSync(outputIndex, 'utf8');
output = output.replace(/documentation \d+\.\d+\.\d+/g, '');
expect(output).toMatchSnapshot();
});

Expand Down
4 changes: 3 additions & 1 deletion __tests__/test.js
Expand Up @@ -103,7 +103,9 @@ describe('html', function() {
const clean = html
.sort((a, b) => a.path > b.path)
.filter(r => r.path.match(/(html)$/))
.map(r => r.contents)
.map(r =>
r.contents.toString().replace(/documentation \d+\.\d+\.\d+/g, '')
)
.join('\n');
expect(clean).toMatchSnapshot();
});
Expand Down

0 comments on commit 6bf3f97

Please sign in to comment.