-
-
Notifications
You must be signed in to change notification settings - Fork 723
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
06045e1
commit 581241b
Showing
2 changed files
with
22 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const expect = require('expect'); | ||
const Secret = require('../../lib/secret'); | ||
|
||
describe('Secret tests', () => { | ||
it('should be the Secret instance', () => { | ||
const string = Secret.secret('hello'); | ||
expect(string).toBeInstanceOf(Secret); | ||
}); | ||
|
||
it('should be the Secret instance when using as object', () => { | ||
const obj = Secret.secret({ password: 'world' }, 'password'); | ||
expect(obj.password).toBeInstanceOf(Secret); | ||
}); | ||
|
||
it('should mask the field when provided', () => { | ||
const obj = Secret.secret({ password: 'world' }, 'password'); | ||
expect(obj.password.getMasked()).toBe('*****'); | ||
}); | ||
}); |