-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
1,236 additions
and
1,190 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<!doctype html> | ||
<p>Hello world</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* eslint-env jest */ | ||
const toFile = require('../lib'); | ||
const fileToBin = require('file-to-bin'); | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
|
||
describe('stripped and repeatedly converted', function() { | ||
var html = ''; | ||
|
||
beforeEach(function() { | ||
html = fs.readFileSync( | ||
path.join(__dirname, 'fixtures', 'stripped.html'), | ||
'utf8' | ||
); | ||
}); | ||
|
||
it('should have fixtures', function() { | ||
expect(html.length).toBeGreaterThan(0); | ||
}); | ||
|
||
it('does nothing to plain html', function() { | ||
const bin = fileToBin(html); | ||
bin.url = 'abc-def-ghi'; | ||
// bin.meta = `<!-- source: https://jsbin.com/${bin.url}/edit --> | ||
// <meta http-equiv="CACHE-CONTROL" content="NO-CACHE">`; | ||
const file = toFile(bin); | ||
const parsed = fileToBin(file); | ||
|
||
expect(parsed.html).toEqual(bin.html); | ||
expect(parsed.url).toEqual(bin.url); | ||
|
||
expect(toFile(parsed)).toEqual(toFile(bin)); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.