Skip to content

Commit

Permalink
refactor: ♻️ rename users-appplication to users
Browse files Browse the repository at this point in the history
  • Loading branch information
zhumeisongsong committed Nov 18, 2024
1 parent 348753e commit 2b7b5f3
Show file tree
Hide file tree
Showing 29 changed files with 26 additions and 20 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export default {
displayName: 'users-application-e2e',
displayName: 'users-e2e',
preset: '../../jest.preset.js',
globalSetup: '<rootDir>/src/support/global-setup.ts',
globalTeardown: '<rootDir>/src/support/global-teardown.ts',
Expand All @@ -14,5 +14,5 @@ export default {
],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/users-application-e2e',
coverageDirectory: '../../coverage/users-e2e',
};
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"name": "users-application-e2e",
"name": "users-e2e",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"projectType": "application",
"implicitDependencies": ["users-application"],
"implicitDependencies": ["users"],
"targets": {
"e2e": {
"executor": "@nx/jest:jest",
"outputs": ["{workspaceRoot}/coverage/{e2eProjectRoot}"],
"options": {
"jestConfig": "apps/users-application-e2e/jest.config.ts",
"jestConfig": "apps/users-e2e/jest.config.ts",
"passWithNoTests": true
},
"dependsOn": ["users-application:build"]
"dependsOn": ["users:build"]
}
}
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
export default {
displayName: 'users-application',
displayName: 'users',
preset: '../../jest.preset.js',
testEnvironment: 'node',
transform: {
'^.+\\.[tj]s$': ['ts-jest', { tsconfig: '<rootDir>/tsconfig.spec.json' }],
},
moduleFileExtensions: ['ts', 'js', 'html'],
coverageDirectory: '../../coverage/apps/users-application',
coverageDirectory: '../../coverage/apps/users',
};
10 changes: 5 additions & 5 deletions apps/users-application/project.json → apps/users/project.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "users-application",
"name": "users",
"$schema": "../../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "apps/users-application/src",
"sourceRoot": "apps/users/src",
"projectType": "application",
"tags": [],
"targets": {
Expand All @@ -10,15 +10,15 @@
"defaultConfiguration": "development",
"dependsOn": ["build"],
"options": {
"buildTarget": "users-application:build",
"buildTarget": "users:build",
"runBuildTargetDependencies": false
},
"configurations": {
"development": {
"buildTarget": "users-application:build:development"
"buildTarget": "users:build:development"
},
"production": {
"buildTarget": "users-application:build:production"
"buildTarget": "users:build:production"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ describe('AppController', () => {
describe('getData', () => {
it('should return "Hello User Service"', () => {
const appController = app.get<AppController>(AppController);
expect(appController.getData()).toEqual({ message: 'Hello User Service' });
expect(appController.getData()).toEqual({
message: 'Hello User Service',
});
});
});
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,19 @@ describe('UsersResolver', () => {
const user: User = { id: '1', name: 'John Doe' };
jest.spyOn(service, 'findById').mockReturnValue(user);

expect(resolver.resolveReference({ __typename: 'User', id: '1' })).toEqual(user);
expect(
resolver.resolveReference({ __typename: 'User', id: '1' }),
).toEqual(user);
expect(service.findById).toHaveBeenCalledWith('1');
});

it('should return undefined if user not found by reference id', () => {
jest.spyOn(service, 'findById').mockReturnValue(undefined);

expect(resolver.resolveReference({ __typename: 'User', id: '2' })).toBeUndefined();
expect(
resolver.resolveReference({ __typename: 'User', id: '2' }),
).toBeUndefined();
expect(service.findById).toHaveBeenCalledWith('2');
});
});
});
});
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ describe('UsersService', () => {
const user: User = service.findById('3');
expect(user).toBeUndefined();
});
});
});
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const { join } = require('path');

module.exports = {
output: {
path: join(__dirname, '../../dist/apps/users-application'),
path: join(__dirname, '../../dist/apps/users'),
},
plugins: [
new NxAppWebpackPlugin({
Expand Down
2 changes: 1 addition & 1 deletion nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"options": {
"targetName": "test"
},
"exclude": ["apps/gateway-e2e/**/*", "apps/users-application-e2e/**/*"]
"exclude": ["apps/gateway-e2e/**/*", "apps/users-e2e/**/*"]
}
]
}

0 comments on commit 2b7b5f3

Please sign in to comment.