Home / File/ project-name.test.js — astro Source File

project-name.test.js — astro Source File

Architecture documentation for project-name.test.js, a javascript file in the astro codebase. 5 imports, 0 dependents.

Entity Profile

Dependency Diagram

graph LR
  cc5a1f99_e70a_2d2e_f2e5_9843d26cb677["project-name.test.js"]
  880e345d_e64a_cd56_e5a1_121b9c58fefd["../dist/index.js"]
  cc5a1f99_e70a_2d2e_f2e5_9843d26cb677 --> 880e345d_e64a_cd56_e5a1_121b9c58fefd
  a235a0d7_582f_6d3a_e9ba_44a62def6ef3["utils.js"]
  cc5a1f99_e70a_2d2e_f2e5_9843d26cb677 --> a235a0d7_582f_6d3a_e9ba_44a62def6ef3
  ba39c8a0_fa83_d32e_0c60_ad5c1c131c40["setup"]
  cc5a1f99_e70a_2d2e_f2e5_9843d26cb677 --> ba39c8a0_fa83_d32e_0c60_ad5c1c131c40
  e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607["strict"]
  cc5a1f99_e70a_2d2e_f2e5_9843d26cb677 --> e1e2fac7_5a95_7a88_cb1e_0a3b91c4e607
  6b0635f9_51ea_77aa_767b_7857878e98a6["node:test"]
  cc5a1f99_e70a_2d2e_f2e5_9843d26cb677 --> 6b0635f9_51ea_77aa_767b_7857878e98a6
  style cc5a1f99_e70a_2d2e_f2e5_9843d26cb677 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

import assert from 'node:assert/strict';
import { describe, it } from 'node:test';
import { projectName } from '../dist/index.js';
import { setup } from './utils.js';

describe('project name', async () => {
	const fixture = setup();

	it('pass in name', async () => {
		const context = { projectName: '', cwd: './foo/bar/baz', prompt: () => {} };
		await projectName(context);
		assert.equal(context.cwd, './foo/bar/baz');
		assert.equal(context.projectName, 'baz');
	});

	it('dot', async () => {
		const context = { projectName: '', cwd: '.', prompt: () => ({ name: 'foobar' }) };
		await projectName(context);
		assert.ok(fixture.hasMessage('"." is not empty!'));
		assert.equal(context.projectName, 'foobar');
	});

	it('dot slash', async () => {
		const context = { projectName: '', cwd: './', prompt: () => ({ name: 'foobar' }) };
		await projectName(context);
		assert.ok(fixture.hasMessage('"./" is not empty!'));
		assert.equal(context.projectName, 'foobar');
	});

	it('empty', async () => {
		const context = {
			projectName: '',
			cwd: './test/fixtures/empty',
			prompt: () => ({ name: 'foobar' }),
		};
		await projectName(context);
		assert.ok(!fixture.hasMessage('"./test/fixtures/empty" is not empty!'));
		assert.equal(context.projectName, 'empty');
	});

	it('not empty', async () => {
		const context = {
			projectName: '',
			cwd: './test/fixtures/not-empty',
			prompt: () => ({ name: 'foobar' }),
		};
		await projectName(context);
		assert.ok(fixture.hasMessage('"./test/fixtures/not-empty" is not empty!'));
		assert.equal(context.projectName, 'foobar');
	});

	it('basic', async () => {
		const context = { projectName: '', cwd: '', prompt: () => ({ name: 'foobar' }) };
		await projectName(context);
		assert.equal(context.cwd, 'foobar');
		assert.equal(context.projectName, 'foobar');
	});

	it('head and tail blank spaces should be trimmed', async () => {
		const context = { projectName: '', cwd: '', prompt: () => ({ name: '  foobar  ' }) };
// ... (65 more lines)

Domain

Dependencies

Frequently Asked Questions

What does project-name.test.js do?
project-name.test.js is a source file in the astro codebase, written in javascript. It belongs to the CoreAstro domain.
What does project-name.test.js depend on?
project-name.test.js imports 5 module(s): ../dist/index.js, node:test, setup, strict, utils.js.
Where is project-name.test.js in the architecture?
project-name.test.js is located at packages/create-astro/test/project-name.test.js (domain: CoreAstro, directory: packages/create-astro/test).

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free