Skip to content

Commit

Permalink
chore(nextjs): use uniq for test
Browse files Browse the repository at this point in the history
  • Loading branch information
Coly010 committed Aug 7, 2024
1 parent 05b8970 commit 01b7536
Showing 1 changed file with 9 additions and 12 deletions.
21 changes: 9 additions & 12 deletions packages/next/src/generators/application/application.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ describe('app', () => {

describe('--style scss', () => {
it('should generate scss styles', async () => {
const name = 'myapp';
const name = uniq();
await applicationGenerator(tree, {
name,
style: 'scss',
Expand All @@ -200,7 +200,7 @@ describe('app', () => {
"import './global.css';
export const metadata = {
title: 'Welcome to myapp',
title: 'Welcome to ${name}',
description: 'Generated by create-nx-workspace',
};
Expand All @@ -222,7 +222,7 @@ describe('app', () => {

describe('--style less', () => {
it('should generate less styles', async () => {
const name = 'myapp2';
const name = uniq();
await applicationGenerator(tree, {
name,
style: 'less',
Expand All @@ -239,7 +239,7 @@ describe('app', () => {
"import './global.less';
export const metadata = {
title: 'Welcome to myapp2',
title: 'Welcome to ${name}',
description: 'Generated by create-nx-workspace',
};
Expand Down Expand Up @@ -360,12 +360,9 @@ describe('app', () => {
const indexContent = tree.read(`${name}/src/app/page.tsx`, 'utf-8');
expect(indexContent).not.toContain(`import styles from './page.module`);
expect(indexContent).toContain(`import styled from '@emotion/styled'`);
expect(tree.read(`${name}/src/app/layout.tsx`, 'utf-8'))
.toMatchInlineSnapshot(`
"import './global.css';
export const metadata = {
title: 'Welcome to `);
expect(
tree.read(`${name}/src/app/layout.tsx`, 'utf-8')
).toMatchInlineSnapshot(``);
});

it('should add jsxImportSource in tsconfig.json', async () => {
Expand Down Expand Up @@ -605,7 +602,7 @@ describe('app', () => {
describe('--linter', () => {
describe('default (eslint)', () => {
it('should add .eslintrc.json and dependencies', async () => {
const name = 'myapp3';
const name = uniq();

await applicationGenerator(tree, {
name,
Expand Down Expand Up @@ -645,7 +642,7 @@ describe('app', () => {
"rules": {
"@next/next/no-html-link-for-pages": [
"error",
"myapp3/pages",
"${name}/pages",
],
},
},
Expand Down

0 comments on commit 01b7536

Please sign in to comment.