Skip to content

Commit

Permalink
Ensure all documented functions exist on the instantiated WebPurify O…
Browse files Browse the repository at this point in the history
…bject; ensure no need to call require('webpurify').default
  • Loading branch information
mileszim committed May 2, 2018
1 parent 78e48b5 commit 052bbc1
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion test/webpurify.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import chai, { expect, should } from 'chai';
import chai, { expect, should, assert } from 'chai';
import sinon from 'sinon';
import http from 'http';
import chaiap from 'chai-as-promised';
Expand Down Expand Up @@ -81,6 +81,9 @@ describe('WebPurify', function() {

// WebPurify
it('should construct a new instance', function() {
const requiredPlugin = require('../dist');
assert.equal(requiredPlugin, WebPurify);
assert.notEqual(requiredPlugin.default, WebPurify);
expect(this.wp).to.be.instanceof(WebPurify);
});

Expand All @@ -107,6 +110,29 @@ describe('WebPurify', function() {
expect(this.wp._query_base).to.deep.equal({ api_key: 'sdfsdfsdf', format: 'json' });
});

it('should have all documented functions available', function() {
const functions = [
'check',
'checkCount',
'replace',
'return',
'addToBlacklist',
'removeFromBlacklist',
'getBlacklist',
'addToWhitelist',
'removeFromWhitelist',
'getWhitelist',
'imgCheck',
'imgStatus',
'imgAccount',
'aimImgCheck',
'aimImgAccount',
'hybridImgCheck',
];
const wpFunctions = Object.getOwnPropertyNames(this.wp);
functions.forEach(f => expect(this.wp[f]).to.not.equal(undefined));
});



// Methods
Expand Down

0 comments on commit 052bbc1

Please sign in to comment.