Skip to content

Commit

Permalink
update post dependency bumping
Browse files Browse the repository at this point in the history
  • Loading branch information
akphi committed Oct 26, 2022
1 parent bd449e7 commit d2f48e9
Show file tree
Hide file tree
Showing 24 changed files with 367 additions and 277 deletions.
36 changes: 36 additions & 0 deletions .changeset/old-paws-relax.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
'@finos/babel-preset-legend-studio': patch
'@finos/eslint-plugin-legend-studio': patch
'@finos/legend-application': patch
'@finos/legend-application-query': patch
'@finos/legend-application-query-bootstrap': patch
'@finos/legend-application-query-deployment': patch
'@finos/legend-application-studio': patch
'@finos/legend-application-studio-bootstrap': patch
'@finos/legend-application-studio-deployment': patch
'@finos/legend-application-taxonomy': patch
'@finos/legend-application-taxonomy-bootstrap': patch
'@finos/legend-application-taxonomy-deployment': patch
'@finos/legend-art': patch
'@finos/legend-dev-utils': patch
'@finos/legend-extension-dsl-data-space': patch
'@finos/legend-extension-dsl-diagram': patch
'@finos/legend-extension-dsl-mastery': patch
'@finos/legend-extension-dsl-persistence': patch
'@finos/legend-extension-dsl-persistence-cloud': patch
'@finos/legend-extension-dsl-service': patch
'@finos/legend-extension-dsl-text': patch
'@finos/legend-extension-format-json-schema': patch
'@finos/legend-extension-format-morphir': patch
'@finos/legend-extension-store-flat-data': patch
'@finos/legend-extension-store-relational': patch
'@finos/legend-extension-store-service-store': patch
'@finos/legend-extension-tracer-zipkin': patch
'@finos/legend-graph': patch
'@finos/legend-query-builder': patch
'@finos/legend-server-depot': patch
'@finos/legend-server-sdlc': patch
'@finos/legend-shared': patch
'@finos/legend-storage': patch
'@finos/stylelint-config-legend-studio': patch
---
36 changes: 36 additions & 0 deletions .changeset/perfect-cherries-shave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
---
'@finos/babel-preset-legend-studio': patch
'@finos/eslint-plugin-legend-studio': patch
'@finos/legend-application': patch
'@finos/legend-application-query': patch
'@finos/legend-application-query-bootstrap': patch
'@finos/legend-application-query-deployment': patch
'@finos/legend-application-studio': patch
'@finos/legend-application-studio-bootstrap': patch
'@finos/legend-application-studio-deployment': patch
'@finos/legend-application-taxonomy': patch
'@finos/legend-application-taxonomy-bootstrap': patch
'@finos/legend-application-taxonomy-deployment': patch
'@finos/legend-art': patch
'@finos/legend-dev-utils': patch
'@finos/legend-extension-dsl-data-space': patch
'@finos/legend-extension-dsl-diagram': patch
'@finos/legend-extension-dsl-mastery': patch
'@finos/legend-extension-dsl-persistence': patch
'@finos/legend-extension-dsl-persistence-cloud': patch
'@finos/legend-extension-dsl-service': patch
'@finos/legend-extension-dsl-text': patch
'@finos/legend-extension-format-json-schema': patch
'@finos/legend-extension-format-morphir': patch
'@finos/legend-extension-store-flat-data': patch
'@finos/legend-extension-store-relational': patch
'@finos/legend-extension-store-service-store': patch
'@finos/legend-extension-tracer-zipkin': patch
'@finos/legend-graph': patch
'@finos/legend-query-builder': patch
'@finos/legend-server-depot': patch
'@finos/legend-server-sdlc': patch
'@finos/legend-shared': patch
'@finos/legend-storage': patch
'@finos/stylelint-config-legend-studio': patch
---
16 changes: 2 additions & 14 deletions fixtures/legend-mock-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,7 @@
*/

import { fastify } from 'fastify';
/**
* Previously, these exports rely on ES module interop to expose `default` export
* properly. But since we use `ESM` for Typescript resolution now, we lose this
*
* TODO: remove these when the package properly work with Typescript's nodenext
* module resolution
*
* @workaround ESM
* See https://github.com/microsoft/TypeScript/issues/49298
* See https://github.com/microsoft/TypeScript/issues/50690
* See https://github.com/fastify/fastify-cors/pull/231
*/
import { default as FastifyCORS } from '@fastify/cors';
import { fastifyCors } from '@fastify/cors';
import TAXONOMY_TREE_DATA from './TEST_DATA__TaxonomyTreeData.json' assert { type: 'json' };
import DOCUMENTATION_DATA from './DummyDocumentationData.json' assert { type: 'json' };

Expand All @@ -40,7 +28,7 @@ const server = fastify({
});

// eslint-disable-next-line @typescript-eslint/no-floating-promises
server.register(FastifyCORS.default, {
server.register(fastifyCors, {
methods: ['OPTIONS'],
origin: [/localhost/],
credentials: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
* limitations under the License.
*/

import { jest } from '@jest/globals';
import { type RenderResult, render, waitFor } from '@testing-library/react';
import {
type TEMPORARY__JestMock,
guaranteeNonNullable,
createMock,
createSpy,
} from '@finos/legend-shared';
import {
type GraphManagerState,
Expand Down Expand Up @@ -83,7 +83,7 @@ export const TEST__provideMockedQueryEditorStore = (customization?: {
TEST_QUERY_ID,
);
const MOCK__QueryEditorStoreProvider = require('./QueryEditorStoreProvider.js'); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
MOCK__QueryEditorStoreProvider.useQueryEditorStore = jest.fn();
MOCK__QueryEditorStoreProvider.useQueryEditorStore = createMock();
MOCK__QueryEditorStoreProvider.useQueryEditorStore.mockReturnValue(value);
return value;
};
Expand Down Expand Up @@ -141,33 +141,32 @@ export const TEST__setUpQueryEditor = async (
);
query.content = 'some content';

jest
.spyOn(MOCK__editorStore.depotServerClient, 'getProject')
.mockReturnValue(Promise.resolve(projectData));
jest
.spyOn(graphManagerState.graphManager, 'getLightQuery')
.mockReturnValue(Promise.resolve(lightQuery));
jest
.spyOn(graphManagerState.graphManager, 'pureCodeToLambda')
.mockReturnValue(
Promise.resolve(new RawLambda(lambda.parameters, lambda.body)),
);
jest
.spyOn(graphManagerState.graphManager, 'getQuery')
.mockReturnValue(Promise.resolve(query));
createSpy(MOCK__editorStore.depotServerClient, 'getProject').mockReturnValue(
Promise.resolve(projectData),
);
createSpy(graphManagerState.graphManager, 'getLightQuery').mockReturnValue(
Promise.resolve(lightQuery),
);
createSpy(graphManagerState.graphManager, 'pureCodeToLambda').mockReturnValue(
Promise.resolve(new RawLambda(lambda.parameters, lambda.body)),
);
createSpy(graphManagerState.graphManager, 'getQuery').mockReturnValue(
Promise.resolve(query),
);
if (rawMappingModelCoverageAnalysisResult) {
jest
.spyOn(graphManagerState.graphManager, 'analyzeMappingModelCoverage')
.mockReturnValue(
Promise.resolve(
graphManagerState.graphManager.buildMappingModelCoverageAnalysisResult(
rawMappingModelCoverageAnalysisResult,
),
createSpy(
graphManagerState.graphManager,
'analyzeMappingModelCoverage',
).mockReturnValue(
Promise.resolve(
graphManagerState.graphManager.buildMappingModelCoverageAnalysisResult(
rawMappingModelCoverageAnalysisResult,
),
);
),
);
}
MOCK__editorStore.buildGraph = jest.fn<TEMPORARY__JestMock>();
graphManagerState.graphManager.initialize = jest.fn<TEMPORARY__JestMock>();
MOCK__editorStore.buildGraph = createMock();
graphManagerState.graphManager.initialize = createMock();

const history = createMemoryHistory({
initialEntries: [generateExistingQueryEditorRoute(lightQuery.id)],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* limitations under the License.
*/

import { jest, expect } from '@jest/globals';
import { expect } from '@jest/globals';
import {
type RenderResult,
render,
Expand All @@ -29,7 +29,7 @@ import {
generateEditorRoute,
LEGEND_STUDIO_ROUTE_PATTERN,
} from '../stores/LegendStudioRouter.js';
import type { PlainObject, TEMPORARY__JestMock } from '@finos/legend-shared';
import { createMock, createSpy, type PlainObject } from '@finos/legend-shared';
import { LegendStudioPluginManager } from '../application/LegendStudioPluginManager.js';
import type { Entity } from '@finos/legend-storage';
import {
Expand Down Expand Up @@ -165,7 +165,7 @@ export const TEST__provideMockedEditorStore = (customization?: {
TEST__getTestGraphManagerState(customization?.pluginManager),
);
const MockedEditorStoreProvider = require('./editor/EditorStoreProvider.js'); // eslint-disable-line @typescript-eslint/no-unsafe-assignment
MockedEditorStoreProvider.useEditorStore = jest.fn();
MockedEditorStoreProvider.useEditorStore = createMock();
MockedEditorStoreProvider.useEditorStore.mockReturnValue(value);
return value;
};
Expand Down Expand Up @@ -247,39 +247,37 @@ export const TEST__setUpEditor = async (
} = data;

// SDLC
jest
.spyOn(MOCK__editorStore.sdlcServerClient, 'getProject')
.mockReturnValue(Promise.resolve(project));
jest
.spyOn(MOCK__editorStore.sdlcServerClient, 'getWorkspace')
.mockReturnValue(Promise.resolve(workspace));
jest
.spyOn(MOCK__editorStore.sdlcServerClient, 'getVersions')
.mockReturnValue(Promise.resolve(projectVersions));
jest
.spyOn(MOCK__editorStore.sdlcServerClient, 'getRevision')
.mockReturnValue(Promise.resolve(curentRevision));
jest
.spyOn(
MOCK__editorStore.sdlcServerClient,
'checkIfWorkspaceIsInConflictResolutionMode',
)
.mockReturnValue(Promise.resolve(false));
jest
.spyOn(MOCK__editorStore.sdlcServerClient, 'isWorkspaceOutdated')
.mockReturnValue(Promise.resolve(false));
jest
.spyOn(MOCK__editorStore.sdlcServerClient, 'getEntities')
.mockReturnValue(Promise.resolve(entities));
jest
.spyOn(MOCK__editorStore.sdlcServerClient, 'getConfiguration')
.mockReturnValue(Promise.resolve(projectConfiguration));
jest
.spyOn(
MOCK__editorStore.sdlcServerClient,
'getLatestProjectStructureVersion',
)
.mockReturnValue(Promise.resolve(latestProjectStructureVersion));
createSpy(MOCK__editorStore.sdlcServerClient, 'getProject').mockReturnValue(
Promise.resolve(project),
);
createSpy(MOCK__editorStore.sdlcServerClient, 'getWorkspace').mockReturnValue(
Promise.resolve(workspace),
);
createSpy(MOCK__editorStore.sdlcServerClient, 'getVersions').mockReturnValue(
Promise.resolve(projectVersions),
);
createSpy(MOCK__editorStore.sdlcServerClient, 'getRevision').mockReturnValue(
Promise.resolve(curentRevision),
);
createSpy(
MOCK__editorStore.sdlcServerClient,
'checkIfWorkspaceIsInConflictResolutionMode',
).mockReturnValue(Promise.resolve(false));
createSpy(
MOCK__editorStore.sdlcServerClient,
'isWorkspaceOutdated',
).mockReturnValue(Promise.resolve(false));
createSpy(MOCK__editorStore.sdlcServerClient, 'getEntities').mockReturnValue(
Promise.resolve(entities),
);
createSpy(
MOCK__editorStore.sdlcServerClient,
'getConfiguration',
).mockReturnValue(Promise.resolve(projectConfiguration));
createSpy(
MOCK__editorStore.sdlcServerClient,
'getLatestProjectStructureVersion',
).mockReturnValue(Promise.resolve(latestProjectStructureVersion));
MOCK__editorStore.sdlcServerClient._setFeatures(
SDLCServerFeaturesConfiguration.serialization.fromJson({
canCreateProject: true,
Expand All @@ -288,40 +286,41 @@ export const TEST__setUpEditor = async (
);

// depot
jest
.spyOn(MOCK__editorStore.depotServerClient, 'getProjects')
.mockReturnValue(Promise.resolve(projects));
jest
.spyOn(MOCK__editorStore.depotServerClient, 'getProjectById')
.mockReturnValue(Promise.resolve(projectData));
jest
.spyOn(MOCK__editorStore.depotServerClient, 'collectDependencyEntities')
.mockReturnValue(Promise.resolve(projectDependency));
jest
.spyOn(MOCK__editorStore.depotServerClient, 'analyzeDependencyTree')
.mockReturnValue(Promise.resolve(projectDependencyInfo));
createSpy(MOCK__editorStore.depotServerClient, 'getProjects').mockReturnValue(
Promise.resolve(projects),
);
createSpy(
MOCK__editorStore.depotServerClient,
'getProjectById',
).mockReturnValue(Promise.resolve(projectData));
createSpy(
MOCK__editorStore.depotServerClient,
'collectDependencyEntities',
).mockReturnValue(Promise.resolve(projectDependency));
createSpy(
MOCK__editorStore.depotServerClient,
'analyzeDependencyTree',
).mockReturnValue(Promise.resolve(projectDependencyInfo));

// TODO: we need to think of how we will mock these calls when we modularize
const graphManagerState = MOCK__editorStore.graphManagerState;
graphManagerState.graphManager.initialize = jest.fn<TEMPORARY__JestMock>();
jest
.spyOn(
graphManagerState.graphManager,
'getAvailableGenerationConfigurationDescriptions',
)
.mockReturnValue(Promise.resolve(availableGenerationDescriptions));
graphManagerState.graphManager.initialize = createMock();
createSpy(
graphManagerState.graphManager,
'getAvailableGenerationConfigurationDescriptions',
).mockReturnValue(Promise.resolve(availableGenerationDescriptions));

// mock change detections (since we do not test them now)
MOCK__editorStore.changeDetectionState.workspaceLocalLatestRevisionState.buildEntityHashesIndex =
jest.fn<TEMPORARY__JestMock>();
createMock();
MOCK__editorStore.sdlcState.buildWorkspaceBaseRevisionEntityHashesIndex =
jest.fn<TEMPORARY__JestMock>();
createMock();
MOCK__editorStore.sdlcState.buildProjectLatestRevisionEntityHashesIndex =
jest.fn<TEMPORARY__JestMock>();
createMock();
MOCK__editorStore.workspaceReviewState.fetchCurrentWorkspaceReview =
jest.fn<TEMPORARY__JestMock>();
createMock();
MOCK__editorStore.workspaceUpdaterState.fetchLatestCommittedReviews =
jest.fn<TEMPORARY__JestMock>();
createMock();

const history = createMemoryHistory({
initialEntries: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
* limitations under the License.
*/

import { describe, test, jest, expect } from '@jest/globals';
import { describe, test, expect } from '@jest/globals';
import { fireEvent, getByText, waitFor } from '@testing-library/react';
import {
type TEMPORARY__JestMock,
integrationTest,
guaranteeNonNullable,
createMock,
} from '@finos/legend-shared';
import { MockedMonacoEditorInstance } from '@finos/legend-art';
import { QUERY_BUILDER_TEST_ID } from '@finos/legend-query-builder';
Expand Down Expand Up @@ -94,14 +94,14 @@ describe(
},
);

const MockedGlobalCompileInFormModeFn = jest.fn<TEMPORARY__JestMock>();
const MockedGlobalCompileInFormModeFn = createMock();
MOCK__editorStore.graphState.globalCompileInFormMode =
MockedGlobalCompileInFormModeFn;
MockedGlobalCompileInFormModeFn.mockReturnValue(
Promise.resolve(FormModeCompilationOutcome.SUCCEEDED),
);
MOCK__editorStore.graphManagerState.graphManager.analyzeMappingModelCoverage =
jest.fn<TEMPORARY__JestMock>();
createMock();
MockedMonacoEditorInstance.getValue.mockReturnValue('');

await TEST__openElementFromExplorerTree(classPath, renderResult);
Expand Down

0 comments on commit d2f48e9

Please sign in to comment.