Skip to content

Commit

Permalink
chore(amplify-util-uibuilder): remove codegen-ui usage
Browse files Browse the repository at this point in the history
  • Loading branch information
Justin Shih committed Sep 27, 2023
1 parent d87adc8 commit f79a767
Show file tree
Hide file tree
Showing 14 changed files with 4,815 additions and 134 deletions.
4 changes: 2 additions & 2 deletions packages/amplify-util-uibuilder/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
"@aws-amplify/amplify-category-api": "^5.6.4",
"@aws-amplify/amplify-cli-core": "4.2.7",
"@aws-amplify/amplify-prompts": "2.8.4",
"@aws-amplify/codegen-ui": "2.14.2",
"@aws-amplify/codegen-ui-react": "2.14.2",
"amplify-codegen": "^4.6.2",
"aws-sdk": "^2.1426.0",
"fs-extra": "^8.1.0",
Expand All @@ -28,10 +26,12 @@
},
"devDependencies": {
"@aws-amplify/appsync-modelgen-plugin": "^2.6.0",
"@aws-amplify/datastore": "^4.7.5",
"@types/fs-extra": "^8.0.1",
"@types/jest": "^29.5.1",
"@types/semver": "^7.1.0",
"@types/tiny-async-pool": "^2.0.0",
"semver": "^7.5.4",
"ts-jest": "^29.1.0"
},
"jest": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import semver from 'semver';
import { ReactRequiredDependencyProvider } from '../commands/utils/codegen-ui-dependency-provider';

describe('ReactStudioDependencyProvider', () => {
const requiredDependencies = new ReactRequiredDependencyProvider().getRequiredDependencies(false);
const requiredDependenciesWithStorageManager = new ReactRequiredDependencyProvider().getRequiredDependencies(true);

describe('getRequiredDependencies', () => {
it('has required dependencies', () => {
expect(requiredDependencies.length).toBeGreaterThan(0);
});

it('includes ui-react', () => {
expect(requiredDependencies.filter((dep) => dep.dependencyName === '@aws-amplify/ui-react')).toBeTruthy();
});

it('includes all valid semver values', () => {
requiredDependencies.forEach((dep) => {
expect(semver.valid(dep.supportedSemVerPattern)).toBeDefined();
});
});

it('includes reasons on all dependencies', () => {
requiredDependencies.forEach((dep) => {
expect(dep.reason.length).toBeGreaterThan(0);
});
});

it('does not include ui-react-storage if user does not use StorageManager', () => {
expect(requiredDependencies.filter((dep) => dep.dependencyName !== '@aws-amplify/ui-react-storage')).toBeTruthy();
});

it('includes ui-react-storage if user is using StorageManager', () => {
expect(requiredDependenciesWithStorageManager.filter((dep) => dep.dependencyName === '@aws-amplify/ui-react-storage')).toBeTruthy();
});
});
});
Loading

0 comments on commit f79a767

Please sign in to comment.