-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add search in ciphers : Allows to search for ciphers which match type, username and uri. URI matching is done through the jslib service * refactor: Externalize CipherType * style: remove warnings about console * fix: We missed this when converting init to setup
- Loading branch information
Showing
8 changed files
with
172 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
module.exports = { | ||
moduleFileExtensions: ['js', 'jsx', 'json'], | ||
setupFilesAfterEnv: ['<rootDir>enzyme.setup.js'] | ||
setupFilesAfterEnv: ['<rootDir>enzyme.setup.js'], | ||
testPathIgnorePatterns: ['@bitwarden/jslib', 'transpiled/'] | ||
} |
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
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,3 @@ | ||
export { | ||
CipherType as default | ||
} from './@bitwarden/jslib/services/cipher.service' |
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
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,83 @@ | ||
import WebVaultClient from './WebVaultClient' | ||
|
||
describe('WebVaultClient', () => { | ||
|
||
describe('weakMatch', () => { | ||
let client | ||
beforeAll(() => { | ||
client = new WebVaultClient('https://me.cozy.wtf') | ||
}) | ||
|
||
it('should match two identic strings', () => { | ||
const source = 'Hello' | ||
const compare = 'Hello' | ||
expect(client.weakMatch(source, compare)).toBeTruthy() | ||
}) | ||
|
||
it('should not match two different strings', () => { | ||
const source = 'Hello' | ||
const compare = 'Bonjour' | ||
expect(client.weakMatch(source, compare)).toBeFalsy() | ||
}) | ||
|
||
it('should match two identic numbers', () => { | ||
const source = 345 | ||
const compare = 345 | ||
expect(client.weakMatch(source, compare)).toBeTruthy() | ||
}) | ||
|
||
it('should not match two different numbers', () => { | ||
const source = 345 | ||
const compare = 999 | ||
expect(client.weakMatch(source, compare)).toBeFalsy() | ||
}) | ||
|
||
xit('should match two booleans', () => { | ||
const source = true | ||
const compare = true | ||
expect(client.weakMatch(source, compare)).toBeTruthy() | ||
}) | ||
|
||
it('should not match different booleans', () => { | ||
const source = true | ||
const compare = false | ||
expect(client.weakMatch(source, compare)).toBeFalsy() | ||
}) | ||
|
||
it('should not match a string and a number', () => { | ||
const source = '0' | ||
const compare = 0 | ||
expect(client.weakMatch(source, compare)).toBeFalsy() | ||
}) | ||
|
||
it('should not match a string with a boolean', () => { | ||
const source = 'Hello' | ||
const compare = true | ||
expect(client.weakMatch(source, compare)).toBeFalsy() | ||
}) | ||
|
||
it('should match a string with an identic string inside an array', () => { | ||
const source = 'Hello' | ||
const compare = ['Bonjour', 'Hello', 'Ciao'] | ||
expect(client.weakMatch(source, compare)).toBeTruthy() | ||
}) | ||
|
||
it('should not match a string with an array of different strings', () => { | ||
const source = 'Hello' | ||
const compare = ['Bye', 'Salut', 'Arrivederci'] | ||
expect(client.weakMatch(source, compare)).toBeFalsy() | ||
}) | ||
|
||
it('should match a string with a matching regexp', () => { | ||
const source = 'Hello' | ||
const compare = /Hel(l)?o/ | ||
expect(client.weakMatch(source, compare)).toBeTruthy() | ||
}) | ||
|
||
it('should not match a string with a non-matching regexp', () => { | ||
const source = 'Hello' | ||
const compare = /Sal(l)?ut/ | ||
expect(client.weakMatch(source, compare)).toBeFalsy() | ||
}) | ||
}) | ||
}) |
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 |
---|---|---|
@@ -1,8 +1,11 @@ | ||
export { WebVaultClient } from './WebVaultClient' | ||
export { CozyUtils } from './CozyUtils' | ||
export { CipherType } from './CipherType' | ||
|
||
export { | ||
VaultContext, | ||
VaultProvider, | ||
withVaultClient | ||
} from './components/VaultContext' | ||
|
||
export VaultUnlocker from './components/VaultUnlocker' |