inventid/opengraph-cacher

View on GitHub
test/mapper.js

Summary

Maintainability
A
2 hrs
Test Coverage
Parsing error: Invalid ecmaVersion.
import {describe, it} from 'mocha';
import assert from 'assert';
import postProcess from '../src/mapper';
 
describe('Mapper', () => {
describe('#postProcess()', async () => {
Similar blocks of code found in 2 locations. Consider refactoring.
it('should prefer the set url', async () => {
const result = await postProcess("http://bit.ly/redirect", {ogUrl : 'http://example.com'});
assert.strictEqual(result.data.url[0].value, 'http://example.com');
});
 
it('should prefer the set url but default to the given one', async () => {
const result = await postProcess("http://bit.ly/redirect", {});
assert.strictEqual(result.data.url[0].value, 'http://bit.ly/redirect');
});
 
Similar blocks of code found in 2 locations. Consider refactoring.
it('should set the name if given', async () => {
const result = await postProcess("http://bit.ly/redirect", {ogSiteName : 'Example'});
assert.strictEqual(result.data.site_name[0].value, 'Example');
});
 
it('should omit the name if not given', async () => {
const result = await postProcess("http://bit.ly/redirect", {});
assert.strictEqual(result.data.site_name, undefined);
});
});
});