summaryrefslogtreecommitdiffhomepage
path: root/packages/server/src/authentication/generateAuthenticationOptions.test.ts
diff options
context:
space:
mode:
authorJarrett Helton <jaydhelton@gmail.com>2021-08-25 21:02:10 -0400
committerJarrett Helton <jaydhelton@gmail.com>2021-08-25 21:02:10 -0400
commitb831fc557aac088c2cace7279decb842bb2214a0 (patch)
tree6569142b2ad7d1a8a797a7be439e6377d2b750ea /packages/server/src/authentication/generateAuthenticationOptions.test.ts
parentf4dff6a0b42dca2c06fd744c087d3c4a2e03577e (diff)
fixing tests and cleanup
Diffstat (limited to 'packages/server/src/authentication/generateAuthenticationOptions.test.ts')
-rw-r--r--packages/server/src/authentication/generateAuthenticationOptions.test.ts20
1 files changed, 10 insertions, 10 deletions
diff --git a/packages/server/src/authentication/generateAuthenticationOptions.test.ts b/packages/server/src/authentication/generateAuthenticationOptions.test.ts
index 93cc398..3f11437 100644
--- a/packages/server/src/authentication/generateAuthenticationOptions.test.ts
+++ b/packages/server/src/authentication/generateAuthenticationOptions.test.ts
@@ -1,11 +1,11 @@
jest.mock('../helpers/generateChallenge');
-import generateAssertionOptions from './generateAuthenticationOptions';
+import generateAuthenticationOptions from './generateAuthenticationOptions';
test('should generate credential request options suitable for sending via JSON', () => {
const challenge = 'totallyrandomvalue';
- const options = generateAssertionOptions({
+ const options = generateAuthenticationOptions({
allowCredentials: [
{
id: Buffer.from('1234', 'ascii'),
@@ -42,7 +42,7 @@ test('should generate credential request options suitable for sending via JSON',
});
test('defaults to 60 seconds if no timeout is specified', () => {
- const options = generateAssertionOptions({
+ const options = generateAuthenticationOptions({
challenge: 'totallyrandomvalue',
allowCredentials: [
{ id: Buffer.from('1234', 'ascii'), type: 'public-key' },
@@ -54,7 +54,7 @@ test('defaults to 60 seconds if no timeout is specified', () => {
});
test('should not set userVerification if not specified', () => {
- const options = generateAssertionOptions({
+ const options = generateAuthenticationOptions({
challenge: 'totallyrandomvalue',
allowCredentials: [
{ id: Buffer.from('1234', 'ascii'), type: 'public-key' },
@@ -66,13 +66,13 @@ test('should not set userVerification if not specified', () => {
});
test('should not set allowCredentials if not specified', () => {
- const options = generateAssertionOptions({ rpID: 'test' });
+ const options = generateAuthenticationOptions({ rpID: 'test' });
expect(options.allowCredentials).toEqual(undefined);
});
test('should generate without params', () => {
- const options = generateAssertionOptions();
+ const options = generateAuthenticationOptions();
const { challenge, ...otherFields } = options;
expect(otherFields).toEqual({
allowCredentials: undefined,
@@ -85,7 +85,7 @@ test('should generate without params', () => {
});
test('should set userVerification if specified', () => {
- const options = generateAssertionOptions({
+ const options = generateAuthenticationOptions({
challenge: 'totallyrandomvalue',
allowCredentials: [
{ id: Buffer.from('1234', 'ascii'), type: 'public-key' },
@@ -98,7 +98,7 @@ test('should set userVerification if specified', () => {
});
test('should set extensions if specified', () => {
- const options = generateAssertionOptions({
+ const options = generateAuthenticationOptions({
challenge: 'totallyrandomvalue',
allowCredentials: [
{ id: Buffer.from('1234', 'ascii'), type: 'public-key' },
@@ -121,7 +121,7 @@ test('should generate a challenge if one is not provided', () => {
};
// @ts-ignore 2345
- const options = generateAssertionOptions(opts);
+ const options = generateAuthenticationOptions(opts);
// base64url-encoded 16-byte buffer from mocked `generateChallenge()`
expect(options.challenge).toEqual('AQIDBAUGBwgJCgsMDQ4PEA');
@@ -130,7 +130,7 @@ test('should generate a challenge if one is not provided', () => {
test('should set rpId if specified', () => {
const rpID = 'simplewebauthn.dev';
- const opts = generateAssertionOptions({
+ const opts = generateAuthenticationOptions({
allowCredentials: [],
rpID,
});