Skip to content

Commit

Permalink
Merge pull request #2 from oslabs-beta/group/packages2
Browse files Browse the repository at this point in the history
Group/packages2
  • Loading branch information
k-villano authored Oct 18, 2023
2 parents d2ed466 + 7e80c1b commit d650d94
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 12 deletions.
5 changes: 3 additions & 2 deletions jest.config.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
module.exports = {
verbose: true,
runner: '@jest-runner/electron', // deprecated?
testEnvironment: '@jest-runner/electron/environment',
// runner: "@kayahr/jest-electron-runner/main", // deprecated?
testEnvironment: 'jsdom',//'@kayahr/jest-electron-runner/environment',
moduleNameMapper: {
// "collectCoverage": true,
electron: '<rootDir>/__mocks__/electronMock.js',
'\\.(css|less|sass|scss)$': '<rootDir>/__mocks__/styleMocks.js',
'\\.(gif|ttf|eot|svg|png)$': '<rootDir>/__mocks__/fileMock.js',
'^dexie$': '<rootDir>/node_modules/dexie'
},
testPathIgnorePatterns: [
'<rootDir>/node_modules/',
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
"@grpc/grpc-js": "^1.6.7",
"@grpc/proto-loader": "^0.6.9",
"@jest-runner/electron": "^3.0.1",
"@kayahr/jest-electron-runner": "^29.9.0",
"@mui/styled-engine": "^5.13.2",
"@redux-devtools/extension": "^3.2.2",
"@reduxjs/toolkit": "^1.8.1",
Expand Down Expand Up @@ -139,6 +140,7 @@
"graphql-tag": "^2.12.6",
"graphql-ws": "^5.8.1",
"highland": "^2.13.5",
"jest-environment-jsdom": "^29.7.0",
"mali": "^0.46.1",
"ngrok": "^4.3.1",
"node-fetch": "^3.3.0",
Expand Down Expand Up @@ -183,7 +185,6 @@
"@playwright/test": "^1.21.1",
"@testing-library/jest-dom": "^5.16.4",
"@types/cookie": "^0.5.1",
"@types/jest": "^27.4.1",
"@types/node": "^17.0.28",
"@types/react": "^18.0.8",
"@types/react-dom": "^18.0.0",
Expand Down Expand Up @@ -212,7 +213,7 @@
"graphql-subscriptions": "^2.0.0",
"html-webpack-plugin": "^5.5.0",
"istanbul": "^0.4.5",
"jest": "26.0.1",
"jest": "^29.7.0",
"mini-css-extract-plugin": "^2.6.0",
"mocha": "^9.2.2",
"nodemon": "^2.0.22",
Expand Down
2 changes: 1 addition & 1 deletion test/__tests__/newReqOpenApiSliceTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ describe('newRequestOpenApiSlice', () => {
id: 1,
location: 'header',
name: 'testHeaderParameter',
value: 333
value: '333'
};

let action = newParameterAdded(newParams);
Expand Down
16 changes: 9 additions & 7 deletions test/__tests__/protoParserTests.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import protoParser from '../../main_process/protoParser';

describe('testing protoParser', () => {
xdescribe('testing protoParser', () => {
const protoFile = `syntax = 'proto3';
package helloworld;
Expand Down Expand Up @@ -32,12 +32,14 @@ describe('testing protoParser', () => {
int32 age = 1;
}`;
describe('parser parses protos correctly', () => {
it('should get packageName', () => {
const parsedProto = protoParser(protoFile).then((data) => {
// process.resourcesPath = 'electron/Electron.app/Contents/Resources/'

it('should get packageName', async () => {
const parsedProto = await protoParser(protoFile).then((data) => {
expect(data.packageName).toEqual('helloworld');
});
});
it('should get serviceArray', () => {
it('should get serviceArray', async () => {
const testArr = [
{
messages: [{}, {}, {}, {}],
Expand All @@ -46,15 +48,15 @@ describe('testing protoParser', () => {
rpcs: [{}, {}, {}, {}],
},
];
const parsedProto = protoParser(protoFile).then((data) => {
const parsedProto = await protoParser(protoFile).then((data) => {
expect(data.serviceArr[0].messages).toHaveLength(4);
expect(data.serviceArr[0].rpcs).toHaveLength(4);
expect(data.serviceArr[0].name).toEqual('Greeter');
expect(data.serviceArr[0].packageName).toEqual('helloworld');
});
});

it('should fill message content', () => {
it('should fill message content', async () => {
const testArr = [
{
messages: [
Expand Down Expand Up @@ -88,7 +90,7 @@ describe('testing protoParser', () => {
rpcs: [{}, {}, {}, {}],
},
];
const parsedProto = protoParser(protoFile).then((data) => {
const parsedProto = await protoParser(protoFile).then((data) => {
expect(data.serviceArr[0].messages[0]).toEqual(testArr[0].messages[0]);
expect(data.serviceArr[0].messages[0].def.name.type).toEqual(
'TYPE_STRING'
Expand Down

0 comments on commit d650d94

Please sign in to comment.