Browse Source

Add input/output fixtures with test

pull/2/head
Luke Childs 9 years ago
parent
commit
9a7b365641
  1. 13
      test/fixtures/input
  2. 23
      test/fixtures/output
  3. 8
      test/unit.js

13
test/fixtures/input

@ -0,0 +1,13 @@
# Frontend Redirects
Redirect 301 /deleted-page/ https://website.com/new-page/
Redirect 302 /new-feature/ https://website.com/coming-soon/
# Admin Redirects
Redirect 301 /admin/ https://website.com/?login=true
# Test alignment
Redirect 301 /old-short-url/ https://website.com/new-short-url/
Redirect 301 /old-loooooooooong-url/ https://website.com/new-long-url/

23
test/fixtures/output

@ -0,0 +1,23 @@
# Frontend Redirects
location /deleted-page/ {
return 301 https://website.com/new-page/;
}
location /new-feature/ {
return 302 https://website.com/coming-soon/;
}
# Admin Redirects
location /admin/ {
return 301 https://website.com/?login=true;
}
# Test alignment
location /old-short-url/ {
return 301 https://website.com/new-short-url/;
}
location /old-loooooooooong-url/ {
return 301 https://website.com/new-long-url/;
}

8
test/unit.js

@ -1,7 +1,15 @@
import test from 'ava';
import { readFileSync } from 'fs';
import htconvert from '../dist/htconvert';
const input = readFileSync('./fixtures/input', 'utf-8');
const output = readFileSync('./fixtures/output', 'utf-8');
test('htconvert should export a function', t => {
t.is(typeof htconvert, 'function');
});
test('htconvert should match input with output', t => {
t.is(htconvert(input), output);
});

Loading…
Cancel
Save