Compare commits

...

2 Commits

Author SHA1 Message Date
Vignesh Rangaishenvi
b52f425b4c Enable notebooks should use account regions 2021-03-17 15:24:23 -07:00
Jordi Bunster
3530633fa2 Test coverage: include all source files (#551)
In addition this changes the thresholds to meet the existing level
of test coverage. This was motivated by work that imported a lot
of existing yet untested (and unexercised) code, which brought down
the total % without adding any more code.
2021-03-16 14:13:36 -07:00
2 changed files with 30 additions and 24 deletions

View File

@@ -21,17 +21,13 @@ module.exports = {
collectCoverage: true,
// An array of glob patterns indicating a set of files for which coverage information should be collected
// collectCoverageFrom: [
// "src/Common/Headers*"
// ],
collectCoverageFrom: ["src/**/*.{js,jsx,ts,tsx}"],
// The directory where Jest should output its coverage files
coverageDirectory: "coverage",
// An array of regexp pattern strings used to skip coverage collection
// coveragePathIgnorePatterns: [
// "/node_modules/"
// ],
coveragePathIgnorePatterns: ["/node_modules/"],
// A list of reporter names that Jest uses when writing coverage reports
coverageReporters: ["json", "text", "cobertura"],
@@ -39,10 +35,10 @@ module.exports = {
// An object that configures minimum threshold enforcement for coverage results
coverageThreshold: {
global: {
branches: 22,
functions: 28,
lines: 33,
statements: 31,
branches: 25,
functions: 25,
lines: 30,
statements: 30,
},
},

View File

@@ -349,8 +349,8 @@ export default class Explorer {
async () => {
this.isNotebookEnabled(
!this.isAuthWithResourceToken() &&
((await this._containsDefaultNotebookWorkspace(this.databaseAccount())) ||
this.isFeatureEnabled(Constants.Features.enableNotebooks))
((await this._containsDefaultNotebookWorkspace(this.databaseAccount())) ||
this.isFeatureEnabled(Constants.Features.enableNotebooks))
);
TelemetryProcessor.trace(Action.NotebookEnabled, ActionModifiers.Mark, {
@@ -372,7 +372,7 @@ export default class Explorer {
this.isSparkEnabledForAccount() &&
this.arcadiaWorkspaces() &&
this.arcadiaWorkspaces().length > 0) ||
this.isFeatureEnabled(Constants.Features.enableSpark)
this.isFeatureEnabled(Constants.Features.enableSpark)
);
if (this.isSparkEnabled()) {
appInsights.trackEvent(
@@ -2006,7 +2006,11 @@ export default class Explorer {
}
const databaseAccount = this.databaseAccount();
const databaseAccountLocation = databaseAccount && databaseAccount.location.toLowerCase();
const databaseAccountLocations = databaseAccount && [
databaseAccount?.location.toLowerCase(),
...databaseAccount?.properties?.readLocations?.map(location => location?.locationName?.toLowerCase()),
...databaseAccount?.properties?.writeLocations?.map(location => location?.locationName?.toLowerCase())
];
const disallowedLocationsUri = `${configContext.BACKEND_ENDPOINT}/api/disallowedLocations`;
const authorizationHeader = getAuthorizationHeader();
try {
@@ -2031,9 +2035,15 @@ export default class Explorer {
this.isNotebooksEnabledForAccount(true);
return;
}
const isAccountInAllowedLocation = !disallowedLocations.some(
(disallowedLocation) => disallowedLocation === databaseAccountLocation
);
const isAccountInAllowedLocation = databaseAccountLocations?.some(
(accountLocation) => {
if (!accountLocation) {
return false;
}
return !disallowedLocations.some(disallowedLocation => disallowedLocation === accountLocation); // not a disallowed location
}
) || false;
this.isNotebooksEnabledForAccount(isAccountInAllowedLocation);
} catch (error) {
Logger.logError(getErrorMessage(error), "Explorer/isNotebooksEnabledForAccount");
@@ -2532,12 +2542,12 @@ export default class Explorer {
this.isFeatureEnabled(Constants.Features.enableKOPanel)
? this.deleteCollectionConfirmationPane.open()
: this.openSidePanel(
"Delete Collection",
<DeleteCollectionConfirmationPanel
explorer={this}
closePanel={() => this.closeSidePanel()}
openNotificationConsole={() => this.expandConsole()}
/>
);
"Delete Collection",
<DeleteCollectionConfirmationPanel
explorer={this}
closePanel={() => this.closeSidePanel()}
openNotificationConsole={() => this.expandConsole()}
/>
);
}
}