tiagobento commented on code in PR #2490: URL: https://github.com/apache/incubator-kie-tools/pull/2490#discussion_r1695593263
########## packages/feel-input-component/tests/semanticTokensProvider.test.ts: ########## @@ -0,0 +1,159 @@ +/* + * Copyright 2024 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { SemanticTokensProvider } from "../src/semanticTokensProvider"; Review Comment: Pls import it from `@kie-tools/dmn-feel-antlr4-parser/dist/semanticTokensProvider` instead of from `src` ########## packages/feel-input-component/tests/semanticTokensProvider.test.ts: ########## @@ -0,0 +1,159 @@ +/* + * Copyright 2024 Red Hat, Inc. and/or its affiliates. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import { SemanticTokensProvider } from "../src/semanticTokensProvider"; +import { + FeelSyntacticSymbolNature, + FeelVariable, + FeelVariables, + FeelVariablesParser, +} from "@kie-tools/dmn-feel-antlr4-parser"; + +import * as Monaco from "@kie-tools-core/monaco-editor"; + +describe("Semantic Tokens Provider", () => { + const tokensFoundByParser: FeelVariable[] = []; + const mockedParser = FeelVariablesParser as jest.Mocked<typeof FeelVariablesParser>; + jest + .spyOn(mockedParser.prototype, "parse") + .mockReturnValue({ availableSymbols: [], feelVariables: tokensFoundByParser }); + + const mockedFeelVariables: jest.Mocked<typeof FeelVariables> = FeelVariables as jest.Mocked<typeof FeelVariables>; + jest.spyOn(mockedFeelVariables.prototype, "parser", "get").mockReturnValue(mockedParser.prototype); + + const cancellationTokenMock = { + isCancellationRequested: false, + onCancellationRequested: jest.fn().mockImplementation(), + }; Review Comment: Could we use the actual implementations? Doing so would make this test easier to read and remove the `parsedTokens` parameter need, no? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
