Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
seleniumhq
GitHub Repository: seleniumhq/selenium
Path: blob/trunk/javascript/selenium-webdriver/test/lib/virtualauthenticatoroptions_test.js
2885 views
1
// Licensed to the Software Freedom Conservancy (SFC) under one
2
// or more contributor license agreements. See the NOTICE file
3
// distributed with this work for additional information
4
// regarding copyright ownership. The SFC licenses this file
5
// to you under the Apache License, Version 2.0 (the
6
// "License"); you may not use this file except in compliance
7
// with the License. You may obtain a copy of the License at
8
//
9
// http://www.apache.org/licenses/LICENSE-2.0
10
//
11
// Unless required by applicable law or agreed to in writing,
12
// software distributed under the License is distributed on an
13
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14
// KIND, either express or implied. See the License for the
15
// specific language governing permissions and limitations
16
// under the License.
17
18
'use strict'
19
20
const assert = require('node:assert')
21
const virtualAuthenticatorOptions = require('selenium-webdriver/lib/virtual_authenticator').VirtualAuthenticatorOptions
22
const Transport = require('selenium-webdriver/lib/virtual_authenticator').Transport
23
const Protocol = require('selenium-webdriver/lib/virtual_authenticator').Protocol
24
25
let options
26
27
describe('VirtualAuthenticatorOptions', function () {
28
beforeEach(function () {
29
options = new virtualAuthenticatorOptions()
30
})
31
32
it('can testSetTransport', function () {
33
options.setTransport(Transport['USB'])
34
assert.equal(options.getTransport(), Transport['USB'])
35
})
36
37
it('can testGetTransport', function () {
38
options._transport = Transport['NFC']
39
assert.equal(options.getTransport(), Transport['NFC'])
40
})
41
42
it('can testSetProtocol', function () {
43
options.setProtocol(Protocol['U2F'])
44
assert.equal(options.getProtocol(), Protocol['U2F'])
45
})
46
47
it('can testGetProtocol', function () {
48
options._protocol = Protocol['CTAP2']
49
assert.equal(options.getProtocol(), Protocol['CTAP2'])
50
})
51
52
it('can testSetHasResidentKey', function () {
53
options.setHasResidentKey(true)
54
assert.equal(options.getHasResidentKey(), true)
55
})
56
57
it('can testGetHasResidentKey', function () {
58
options._hasResidentKey = false
59
assert.equal(options.getHasResidentKey(), false)
60
})
61
62
it('can testSetHasUserVerification', function () {
63
options.setHasUserVerification(true)
64
assert.equal(options.getHasUserVerification(), true)
65
})
66
67
it('can testGetHasUserVerification', function () {
68
options._hasUserVerification = false
69
assert.equal(options.getHasUserVerification(), false)
70
})
71
72
it('can testSetIsUserConsenting', function () {
73
options.setIsUserConsenting(true)
74
assert.equal(options.getIsUserConsenting(), true)
75
})
76
77
it('can testGetIsUserConsenting', function () {
78
options._isUserConsenting = false
79
assert.equal(options.getIsUserConsenting(), false)
80
})
81
82
it('can testSetIsUserVerified', function () {
83
options.setIsUserVerified(true)
84
assert.equal(options.getIsUserVerified(), true)
85
})
86
87
it('can testGetIsUserVerified', function () {
88
options._isUserVerified = false
89
assert.equal(options.getIsUserVerified(), false)
90
})
91
92
it('can testToDictWithDefaults', function () {
93
let default_options = options.toDict()
94
assert.equal(default_options['transport'], Transport['USB'])
95
assert.equal(default_options['protocol'], Protocol['CTAP2'])
96
assert.equal(default_options['hasResidentKey'], false)
97
assert.equal(default_options['hasUserVerification'], false)
98
assert.equal(default_options['isUserConsenting'], true)
99
assert.equal(default_options['isUserVerified'], false)
100
})
101
})
102
103