-
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.
This commit fixes existing unit tests following recent changes, it also adds new ones where appropriate. Coverage reports a small amount of missing coverage in users.js but I have no idea how to cover that!
- Loading branch information
Andrew Isherwood
committed
Dec 23, 2020
1 parent
e8f2bfe
commit 1df0c35
Showing
12 changed files
with
812 additions
and
114 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
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
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,30 @@ | ||
// The thing we're testing | ||
const { encrypt, decrypt } = require('../../helpers/encryption'); | ||
|
||
process.env.KEY = 'B4QEGpy_Ad_MjuEIAoSNWhegBHrNBItN2aV1Ua1g2A4'; | ||
|
||
describe('encypt', () => { | ||
// For a given key, we receive something not null | ||
// back. This is about as meaningful as we can hope to get with | ||
// this test as what we get back is not predictable | ||
it('should return a correctly encrpypted string', async (done) => { | ||
const result = await encrypt('Death Star Plans'); | ||
expect(result).not.toBeNull(); | ||
done(); | ||
}); | ||
}); | ||
|
||
describe('decrypt', () => { | ||
// For a given cipher text, check we get back what we expect | ||
it('should return a correctly decrpypted string', async (done) => { | ||
const result = await decrypt('9ec-OZZ6HZzE8gG9VheeNYlMT_rrvTD8Lg1LPjUjD1fyjq1F-4LcM4ufiqdlVCfzoW3k4sSp-O0'); | ||
expect(result).toEqual('Death Star Plans'); | ||
done(); | ||
}); | ||
it('should throw when passed an invalid cipher text', async (done) => { | ||
await expect( | ||
decrypt('9ac-OZZ6HZzE8gG9VheeNYlMT_rrvTD8Lg1LPjUjD1fyjq1F-4LcM4ufiqdlVCfzoW3k4sSp-O0') | ||
).rejects.toBeTruthy(); | ||
done(); | ||
}); | ||
}); |
Oops, something went wrong.