• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

microsoft / botbuilder-js / 7641848477

24 Jan 2024 02:43PM CUT coverage: 84.48% (+0.003%) from 84.477%
7641848477

push

github

web-flow
fix: [#4582] UserAssignedIdentity(WorkloadIdentity) auth fails with 'scope https://api.botframework.com is not valid' (#4607)

* Add scope post-fix in managedIdentityAuthenticator.

* Fix unit test

9986 of 13105 branches covered (0.0%)

Branch coverage included in aggregate %.

3 of 3 new or added lines in 1 file covered. (100.0%)

20414 of 22880 relevant lines covered (89.22%)

7192.27 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

12.5
/libraries/botbuilder-dialogs-adaptive/src/entityAssignmentComparer.ts
1
/**
2
 * @module adaptive-expressions
3
 */
4
/**
5
 * Copyright (c) Microsoft Corporation. All rights reserved.
6
 * Licensed under the MIT License.
7
 */
8
import { AdaptiveEvents } from './adaptiveEvents';
2✔
9
import { EntityAssignment } from './entityAssignment';
10

11
/**
12
 * Compare two entity assignments to determine their relative priority.
13
 *
14
 * @remarks
15
 * Compare by event: assignEntity, chooseProperty, chooseEntity
16
 * Then by operations in order from schema (usually within assignEntity).
17
 * Then by unexpected before expected.
18
 * Then by oldest turn first.
19
 * Then by minimum position in utterance.
20
 */
21
export class EntityAssignmentComparer {
2✔
22
    private static eventPreference = [
2✔
23
        AdaptiveEvents.assignEntity,
24
        AdaptiveEvents.chooseProperty,
25
        AdaptiveEvents.chooseEntity,
26
    ];
27

28
    /**
29
     * Initializes a new instance of the [EntityAssignmentComparer](xref:botbuilder-dialogs-adaptive.EntityAssignmentComparer) class.
30
     *
31
     * @param operationPreference Preference on operations.
32
     */
33
    constructor(private operationPreference: string[]) {}
8✔
34

35
    /**
36
     * Compares [EntityAssignment](xref:botbuilder-dialogs-adaptive.EntityAssignment) x against y to determine its relative priority.
37
     *
38
     * @param x First entity assigment to compare.
39
     * @param y Second entity assigment to compare.
40
     * @returns Numerical value representing x's relative priority.
41
     */
42
    compare(x: Partial<EntityAssignment>, y: Partial<EntityAssignment>): number {
43
        // Order by event.
44
        let comparison: number =
45
            EntityAssignmentComparer.eventPreference.indexOf(x.event) -
×
46
            EntityAssignmentComparer.eventPreference.indexOf(y.event);
47
        if (comparison === 0) {
×
48
            // Order by operations.
49
            comparison = this.operationPreference.indexOf(x.operation) - this.operationPreference.indexOf(y.operation);
×
50
            if (comparison === 0) {
×
51
                // Unexpected before expected.
52
                if (x.isExpected === y.isExpected) {
×
53
                    comparison = 0;
×
54
                } else {
55
                    comparison = x.isExpected ? -1 : 1;
×
56
                }
57

58
                if (comparison === 0) {
×
59
                    // Order by position in utterance.
60
                    comparison = x.value?.start - y.value?.start;
×
61
                }
62
            }
63
        }
64

65
        return comparison;
×
66
    }
67
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc