Path: blob/trunk/javascript/selenium-webdriver/test/lib/virtualauthenticatoroptions_test.js
2885 views
// Licensed to the Software Freedom Conservancy (SFC) under one1// or more contributor license agreements. See the NOTICE file2// distributed with this work for additional information3// regarding copyright ownership. The SFC licenses this file4// to you under the Apache License, Version 2.0 (the5// "License"); you may not use this file except in compliance6// with the License. You may obtain a copy of the License at7//8// http://www.apache.org/licenses/LICENSE-2.09//10// Unless required by applicable law or agreed to in writing,11// software distributed under the License is distributed on an12// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY13// KIND, either express or implied. See the License for the14// specific language governing permissions and limitations15// under the License.1617'use strict'1819const assert = require('node:assert')20const virtualAuthenticatorOptions = require('selenium-webdriver/lib/virtual_authenticator').VirtualAuthenticatorOptions21const Transport = require('selenium-webdriver/lib/virtual_authenticator').Transport22const Protocol = require('selenium-webdriver/lib/virtual_authenticator').Protocol2324let options2526describe('VirtualAuthenticatorOptions', function () {27beforeEach(function () {28options = new virtualAuthenticatorOptions()29})3031it('can testSetTransport', function () {32options.setTransport(Transport['USB'])33assert.equal(options.getTransport(), Transport['USB'])34})3536it('can testGetTransport', function () {37options._transport = Transport['NFC']38assert.equal(options.getTransport(), Transport['NFC'])39})4041it('can testSetProtocol', function () {42options.setProtocol(Protocol['U2F'])43assert.equal(options.getProtocol(), Protocol['U2F'])44})4546it('can testGetProtocol', function () {47options._protocol = Protocol['CTAP2']48assert.equal(options.getProtocol(), Protocol['CTAP2'])49})5051it('can testSetHasResidentKey', function () {52options.setHasResidentKey(true)53assert.equal(options.getHasResidentKey(), true)54})5556it('can testGetHasResidentKey', function () {57options._hasResidentKey = false58assert.equal(options.getHasResidentKey(), false)59})6061it('can testSetHasUserVerification', function () {62options.setHasUserVerification(true)63assert.equal(options.getHasUserVerification(), true)64})6566it('can testGetHasUserVerification', function () {67options._hasUserVerification = false68assert.equal(options.getHasUserVerification(), false)69})7071it('can testSetIsUserConsenting', function () {72options.setIsUserConsenting(true)73assert.equal(options.getIsUserConsenting(), true)74})7576it('can testGetIsUserConsenting', function () {77options._isUserConsenting = false78assert.equal(options.getIsUserConsenting(), false)79})8081it('can testSetIsUserVerified', function () {82options.setIsUserVerified(true)83assert.equal(options.getIsUserVerified(), true)84})8586it('can testGetIsUserVerified', function () {87options._isUserVerified = false88assert.equal(options.getIsUserVerified(), false)89})9091it('can testToDictWithDefaults', function () {92let default_options = options.toDict()93assert.equal(default_options['transport'], Transport['USB'])94assert.equal(default_options['protocol'], Protocol['CTAP2'])95assert.equal(default_options['hasResidentKey'], false)96assert.equal(default_options['hasUserVerification'], false)97assert.equal(default_options['isUserConsenting'], true)98assert.equal(default_options['isUserVerified'], false)99})100})101102103