Skip to content

Instantly share code, notes, and snippets.

@eddyystop
Last active September 18, 2018 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eddyystop/ae7e861af0eec701e724bfc74e9aa6e6 to your computer and use it in GitHub Desktop.
Save eddyystop/ae7e861af0eec701e724bfc74e9aa6e6 to your computer and use it in GitHub Desktop.
Template generated by feathers-plus/cli for a hook unit test
const assert = require('assert');
const verifyEmail = require('../../../../src/hooks/discard');
describe('Test /hooks/discard.unit.test.js', () => {
// eslint-disable-next-line no-unused-vars
let contextBefore, contextAfterPaginated,
// eslint-disable-next-line no-unused-vars
contextAfter, contextAfterMultiple;
beforeEach(() => {
contextBefore = {
type: 'before',
params: { provider: 'socketio' },
data: {
}
};
contextAfter = {
type: 'after',
params: { provider: 'socketio' },
result: {
}
};
contextAfterMultiple = {
type: 'after',
params: { provider: 'socketio' },
result: [
]
};
contextAfterPaginated = {
type: 'after',
method: 'find',
params: { provider: 'socketio' },
result: {
data: [
]
} };
contextAfterPaginated.result.total = contextAfterPaginated.result.data.length;
});
it('Hook exists', () => {
assert(typeof verifyEmail === 'function', 'Hook is not a function.');
});
it('???', () => {
contextBefore.method = 'create';
/*
verifyEmail()(contextBefore);
assert.deepEqual(contextBefore.data, {
});
*/
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment