|
| 1 | +import { |
| 2 | + addFunction, |
| 3 | + amplifyPushAuth, |
| 4 | + createNewProjectDir, |
| 5 | + deleteProject, |
| 6 | + deleteProjectDir, |
| 7 | + generateRandomShortId, |
| 8 | + initJSProjectWithProfile, |
| 9 | + loadFunctionTestFile, |
| 10 | + overrideFunctionSrcNode, |
| 11 | +} from '@aws-amplify/amplify-e2e-core'; |
| 12 | +import { v4 as uuid } from 'uuid'; |
| 13 | + |
| 14 | +describe('amplify push function cases:', () => { |
| 15 | + let projRoot: string; |
| 16 | + |
| 17 | + beforeEach(async () => { |
| 18 | + projRoot = await createNewProjectDir('multiple-function-push'); |
| 19 | + }); |
| 20 | + |
| 21 | + afterEach(async () => { |
| 22 | + await deleteProject(projRoot); |
| 23 | + deleteProjectDir(projRoot); |
| 24 | + }); |
| 25 | + |
| 26 | + it('should be able to push multiple functions at the same time', async () => { |
| 27 | + const projName = `multilambda${generateRandomShortId()}`; |
| 28 | + await initJSProjectWithProfile(projRoot, { name: projName }); |
| 29 | + |
| 30 | + const [shortId] = uuid().split('-'); |
| 31 | + const functionName = `nodetestfunction${shortId}`; |
| 32 | + |
| 33 | + await addFunction(projRoot, { functionTemplate: 'Hello World', name: functionName }, 'nodejs'); |
| 34 | + await amplifyPushAuth(projRoot); |
| 35 | + |
| 36 | + const functionCode = loadFunctionTestFile('case-function.js').replace('{{testString}}', 'Hello from Lambda!'); |
| 37 | + overrideFunctionSrcNode(projRoot, functionName, functionCode); |
| 38 | + await addFunction(projRoot, { functionTemplate: 'Hello World' }, 'python'); |
| 39 | + |
| 40 | + await amplifyPushAuth(projRoot); |
| 41 | + }); |
| 42 | +}); |
0 commit comments