Skip to content

Commit 5941f88

Browse files
author
Vieltojarvi
committed
PR feedback
1 parent a40f891 commit 5941f88

File tree

3 files changed

+15
-11
lines changed

3 files changed

+15
-11
lines changed

packages/cli/src/commands/sandbox/sandbox-seed/sandbox_seed_command.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,9 @@ export class SandboxSeedCommand implements CommandModule<object> {
4747
AMPLIFY_BACKEND_IDENTIFIER: JSON.stringify(backendID),
4848
},
4949
});
50-
} catch (err) {
50+
} finally {
5151
printer.stopSpinner();
52-
throw err;
5352
}
54-
printer.stopSpinner();
5553
printer.printNewLine();
5654
printer.print(`${format.success('✔')} seed has successfully completed`);
5755
};

packages/integration-tests/src/test-project-setup/seed_test_project.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ class SeedTestProject extends TestProjectBase {
120120
const command = execaSync('npx', ['which', 'ampx'], {
121121
cwd: this.projectDirPath,
122122
}).stdout.trim();
123-
const seedPolicyProcess = await execa(
123+
const seedPolicyProcessResult = await execa(
124124
command,
125125
['sandbox', 'seed', 'generate-policy'],
126126
{
@@ -129,8 +129,9 @@ class SeedTestProject extends TestProjectBase {
129129
},
130130
);
131131

132-
const startingInd = seedPolicyProcess.stdout.indexOf('{');
133-
const cleanedPolicyString = seedPolicyProcess.stdout.slice(startingInd);
132+
const startingInd = seedPolicyProcessResult.stdout.indexOf('{');
133+
const cleanedPolicyString =
134+
seedPolicyProcessResult.stdout.slice(startingInd);
134135

135136
const clientConfig = await generateClientConfig(backendIdentifier, '1.3');
136137
if (!clientConfig.custom) {
@@ -212,6 +213,7 @@ class SeedTestProject extends TestProjectBase {
212213
items {
213214
id
214215
content
216+
owner
215217
}
216218
}
217219
}
@@ -222,5 +224,6 @@ class SeedTestProject extends TestProjectBase {
222224
content.data.listTodos.items[0].content,
223225
`Todo list item for ${testUsername}`,
224226
);
227+
assert.ok(content.data.listTodos.items[0].owner);
225228
}
226229
}

packages/integration-tests/src/test-projects/seed-test-project/amplify/seed/seed.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,14 @@ import { createAndSignUpUser, signInUser } from '@aws-amplify/seed';
22
import * as auth from 'aws-amplify/auth';
33
import type { Schema } from './../data/resource.js';
44
import { Amplify } from 'aws-amplify';
5-
// @ts-ignore typescript does not like this import
6-
import outputs from '../../amplify_outputs.json';
75
import { generateClient } from 'aws-amplify/api';
86
import { SemVer } from 'semver';
97
import crypto from 'node:crypto';
8+
import { readFile } from 'node:fs/promises';
9+
10+
const outputFile = JSON.parse(
11+
await readFile('../../amplify_outputs.json', { encoding: 'utf8' }),
12+
);
1013

1114
// TODO: this is a work around - in theory this should be fixed
1215
// it seems like as of amplify v6 , some of the code only runs in the browser ...
@@ -19,12 +22,12 @@ if (process.versions.node) {
1922
}
2023
}
2124

22-
Amplify.configure(outputs);
25+
Amplify.configure(outputFile);
2326

2427
const dataClient = generateClient<Schema>();
2528

26-
const username1 = 'testUser@testing.com';
27-
const password1 = 'T3st_Passw0rd*';
29+
const username1 = 'testUser@amazon.com';
30+
const password1 = `T3st_Passw0rd*${Math.random()}`;
2831

2932
const user1 = await createAndSignUpUser({
3033
username: username1,

0 commit comments

Comments
 (0)