Skip to content

Commit

Permalink
Fix new instance bug
Browse files Browse the repository at this point in the history
  • Loading branch information
flexdinesh committed Feb 5, 2018
1 parent b4ec54d commit 4423f42
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,5 +105,5 @@ class Typy {
}
}

const { t } = new Typy();
const t = (input, objectPath) => new Typy().t(input, objectPath);
export default t;
10 changes: 10 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,16 @@ describe('Type', () => {
});
});

describe('New Instance', () => {
it('should return new instance for each input', () => {
const stringType = t('hello');
assert(stringType.isString === true, 'New Instance check didn\'t work :(');
const numberType = t(123);
assert(numberType.isNumber === true, 'New Instance check didn\'t work :(');
assert(stringType.isString === true, 'New Instance check didn\'t work :(');
});
});

describe('Monkey Test', () => {
it('should not throw error for any input', () => {
const mockObj = { goodKey: 'hello' };
Expand Down

0 comments on commit 4423f42

Please sign in to comment.