3 changed files with 53 additions and 9 deletions
@ -1,13 +1,43 @@ |
|||
import { removeKey, setKey, getKey } from "../src/services/Keystore"; |
|||
|
|||
test('calls set keystore key', () => { |
|||
expect(setKey.bind('100', '100')).not.toThrow(); |
|||
}) |
|||
return setKey('100', '100') |
|||
.then((outcome) => { |
|||
expect(outcome).toEqual(true); |
|||
}); |
|||
}); |
|||
|
|||
test('calls get keystore key', () => { |
|||
expect(getKey.bind('100')).not.toThrow(); |
|||
return getKey('100') |
|||
.then((outcome) => { |
|||
expect(outcome).toEqual('1234567890'); |
|||
}); |
|||
}) |
|||
|
|||
test('calls remove keystore key', () => { |
|||
expect(removeKey.bind('100')).not.toThrow(); |
|||
return removeKey('100') |
|||
.then((outcome) => { |
|||
expect(outcome).toEqual(true); |
|||
}); |
|||
}) |
|||
|
|||
test('get non-existing keystore key', () => { |
|||
return getKey('notakey') |
|||
.then((outcome) => { |
|||
expect(outcome).toEqual(null); |
|||
}); |
|||
}) |
|||
|
|||
test('remove non-existing keystore key', () => { |
|||
return removeKey('notakey') |
|||
.then((outcome) => { |
|||
expect(outcome).toEqual(false); |
|||
}); |
|||
}) |
|||
|
|||
test('setKey handles case where settings fails', () => { |
|||
return setKey('savefailed') |
|||
.then((outcome) => { |
|||
expect(outcome).toEqual(false); |
|||
}); |
|||
}) |
Loading…
Reference in new issue