Skip to content

Commit

Permalink
test: reset test schema
Browse files Browse the repository at this point in the history
  • Loading branch information
dpilch committed Nov 17, 2023
1 parent f8c559f commit 72adfa6
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,25 @@ describe('build app - JS', () => {
});

it('fails build with syntax error in models', async () => {
const schemaText = `input AMPLIFY { globalAuthRule: AuthRule = { allow: public } }\n${(Object.values(schemas)[0] as any).sdl}`;
updateApiSchemaWithText(projectRoot, apiName, schemaText);
await generateStatementsAndTypes(projectRoot);
await writeFileSync(path.join(projectRoot, 'src', 'models', 'index.d.ts'), 'foo\nbar');
await expect(craBuild(projectRoot, { ...config })).rejects.toThrowError();
});

it('fails build with syntax error in statements', async () => {
const schemaText = `input AMPLIFY { globalAuthRule: AuthRule = { allow: public } }\n${(Object.values(schemas)[0] as any).sdl}`;
updateApiSchemaWithText(projectRoot, apiName, schemaText);
await generateModels(projectRoot);
await generateStatementsAndTypes(projectRoot);
await writeFileSync(path.join(projectRoot, 'src', 'graphql', 'queries.ts'), 'foo\nbar');
await expect(craBuild(projectRoot, { ...config })).rejects.toThrowError();
});

it('fails build with syntax error in types', async () => {
const schemaText = `input AMPLIFY { globalAuthRule: AuthRule = { allow: public } }\n${(Object.values(schemas)[0] as any).sdl}`;
updateApiSchemaWithText(projectRoot, apiName, schemaText);
await generateModels(projectRoot);
await generateStatementsAndTypes(projectRoot);
await writeFileSync(path.join(projectRoot, 'src', 'API.ts'), 'foo\nbar');
Expand Down

0 comments on commit 72adfa6

Please sign in to comment.