path#join TypeScript Examples

The following examples show how to use path#join. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: node-utils.ts    From askql with MIT License 8 votes vote down vote up
export function getTargetPath(
  path: string,
  targetExt: string | undefined,
  outDir: string = '../dist'
) {
  const rootDir = join(__dirname, '../src');
  const testDir = relative(rootDir, dirname(path));
  const targetDir = join(rootDir, outDir, testDir);
  const { name: testName, ext } = parse(path);
  return join(targetDir, `${testName}.${targetExt ?? ext}`);
}
Example #2
Source File: builders.utils.ts    From nx-plugins with MIT License 7 votes vote down vote up
export async function getTestArchitect() {
  const architectHost = new TestingArchitectHost('/root', '/root');
  const registry = new schema.CoreSchemaRegistry();
  registry.addPostTransform(schema.transforms.addUndefinedDefaults);

  const architect = new Architect(architectHost, registry);

  await architectHost.addBuilderFromPackage(join(__dirname, '../..'));

  return [architect, architectHost] as [Architect, TestingArchitectHost];
}
Example #3
Source File: [slug].tsx    From 1loc with MIT License 6 votes vote down vote up
getStaticProps = async ({ params }: { params: SnippetPageParams }) => {
    const snippets = loadSnippets();

    const { category, slug } = params;
    const fileContents = fs.readFileSync(join(SNIPPETS_DIR, category, `${slug}.md`));
    const { data: frontMatter, content } = matter(fileContents);

    // Determine the next and previous posts
    const index = snippets.findIndex((s) => s.slug === slug);
    const categories = Object.keys(groupByCategory(snippets));

    const prevSnippet = index <= 0 ? null : snippets[index - 1];
    const nextSnippet = index >= snippets.length - 1 ? null : snippets[index + 1];

    return {
        props: {
            categories,
            content,
            frontMatter,
            prevSnippet,
            nextSnippet,
            snippet: snippets[index],
        },
    };
}
Example #4
Source File: [slug].tsx    From this-vs-that with MIT License 6 votes vote down vote up
getStaticProps = async ({ params }: { params: PostPageParams }) => {
    const { slug } = params;
    const postFile = `${slug}.md`;
    const postFilePath = join(POSTS_DIR, postFile);
    const fileContents = fs.readFileSync(postFilePath);
    const { data: frontMatter, content } = matter(fileContents);

    // Determine the next and previous posts
    const files = fs.readdirSync(join(POSTS_DIR));
    const index = files.indexOf(postFile);

    const prevPost =
        index <= 0
            ? null
            : {
                  slug: files[index - 1].replace('.md', ''),
                  title: matter(fs.readFileSync(join(POSTS_DIR, files[index - 1]))).data.title,
              };
    const nextPost =
        index >= files.length - 1
            ? null
            : {
                  slug: files[index + 1].replace('.md', ''),
                  title: matter(fs.readFileSync(join(POSTS_DIR, files[index + 1]))).data.title,
              };

    return {
        props: {
            content,
            frontMatter,
            prevPost,
            nextPost,
        },
    };
}
Example #5
Source File: gcloud-storage.service.ts    From nestjs-gcloud-storage with MIT License 6 votes vote down vote up
async upload(
    fileMetadata: UploadedFileMetadata,
    perRequestOptions: Partial<GCloudStoragePerRequestOptions> = null,
  ): Promise<string> {
    const filename = uuid();
    const gcFilename =
      perRequestOptions && perRequestOptions.prefix ? join(perRequestOptions.prefix, filename) : filename;
    const gcFile = this.bucket.file(gcFilename);

    // override global options with the provided ones for this request
    perRequestOptions = {
      ...this.options,
      ...perRequestOptions,
    };

    const writeStreamOptions = perRequestOptions && perRequestOptions.writeStreamOptions;

    const { predefinedAcl = 'publicRead' } = perRequestOptions;
    const streamOpts: CreateWriteStreamOptions = {
      predefinedAcl: predefinedAcl,
      ...writeStreamOptions,
    };

    const contentType = fileMetadata.mimetype;

    if (contentType) {
      streamOpts.metadata = { contentType };
    }

    return new Promise((resolve, reject) => {
      gcFile
        .createWriteStream(streamOpts)
        .on('error', (error) => reject(error))
        .on('finish', () => resolve(this.getStorageUrl(gcFilename, perRequestOptions)))
        .end(fileMetadata.buffer);
    });
  }
Example #6
Source File: index.ts    From nestjs-proto-gen-ts with MIT License 6 votes vote down vote up
private output(file: string, pkg: string, tmpl: string): void {
        const root = new Root();

        this.resolveRootPath(root);

        root.loadSync(file, {
            keepCase: this.options.keepCase,
            alternateCommentMode: this.options.comments
        }).resolveAll();

        this.walkTree(root);

        const results = compile(tmpl)(root);
        const outputFile = this.options.output ? join(this.options.output, file.replace(/^.+?[/\\]/, '')) : file;
        const outputPath = join(dirname(outputFile), `${basename(file, extname(file))}.ts`);

        outputFileSync(outputPath, results, 'utf8');
    }
Example #7
Source File: collectCoverage.ts    From Assistive-Webdriver with MIT License 6 votes vote down vote up
export async function collectCoverage(url: string) {
  if (process.env.ENABLE_COVERAGE === "1") {
    try {
      const response = await fetch(`${url}/__coverage__`);
      if (response.ok) {
        const json = await response.buffer();
        const nycFolder = join(process.cwd(), ".nyc_output");
        await promises.mkdir(nycFolder, { recursive: true });
        const fileName = join(nycFolder, `${createUUID()}.json`);
        await promises.writeFile(fileName, json);
        info(`Successfully saved code coverage from the VM in ${fileName}.`);
      } else {
        warn(`Code coverage does not seem to be enabled in the VM.`);
      }
    } catch (error) {
      warn(`Failed to collect/save code coverage from the VM`, error);
    }
  }
}
Example #8
Source File: ahkHoverProvider.ts    From vscode-autohotkey with MIT License 6 votes vote down vote up
private initSnippetCache(context: ExtensionContext) {
        const ahk = JSON.parse(readFileSync(join(context.extensionPath, "snippets", "ahk.json"), "UTF8"));
        this.snippetCache = new Map<string, Snippet>();
        // tslint:disable-next-line: forin
        for (const key in ahk) {
            const snip = ahk[key] as Snippet;
            if (typeof snip.body === 'string') {
                snip.body = snip.body?.replace(/\d{1}:/g, "");
            }
            this.snippetCache.set(key.toLowerCase(), snip);
        }
    }
Example #9
Source File: examples.spec.ts    From graphql-eslint with MIT License 6 votes vote down vote up
describe('Examples', () => {
  it('should work on `.graphql` files', () => {
    const cwd = join(ROOT_CWD, 'examples/basic');
    const results = getESLintOutput(cwd);
    expect(countErrors(results)).toBe(6);
    testSnapshot(results);
  });

  it('should work on `.js` files', () => {
    const cwd = join(ROOT_CWD, 'examples/code-file');
    const results = getESLintOutput(cwd);
    expect(countErrors(results)).toBe(4);
    testSnapshot(results);
  });

  it('should work with `graphql-config`', () => {
    const cwd = join(ROOT_CWD, 'examples/graphql-config');
    const results = getESLintOutput(cwd);
    expect(countErrors(results)).toBe(2);
    testSnapshot(results);
  });

  it('should work with `graphql-config` on `.js` files', () => {
    const cwd = join(ROOT_CWD, 'examples/graphql-config-code-file');
    const results = getESLintOutput(cwd);
    expect(countErrors(results)).toBe(4);
    testSnapshot(results);
  });

  it('should work with `eslint-plugin-prettier`', () => {
    const cwd = join(ROOT_CWD, 'examples/prettier');
    const results = getESLintOutput(cwd);
    expect(countErrors(results)).toBe(23);
    testSnapshot(results);
  });
});
Example #10
Source File: packaging-manager.ts    From nx-plugins with MIT License 6 votes vote down vote up
private async putAssetsNextToFunctionFiles(
    assets: string[],
    outputAbsolutePath: string,
  ): Promise<void> {
    if (!assets.length) {
      return;
    }
    await Promise.all(
      assets.map(async (file) => {
        const src = join(this.originalServicePath, file);
        const dst = join(outputAbsolutePath, file);
        await ensureDir(dirname(dst));
        return await copyFile(src, dst);
      }),
    );
  }
Example #11
Source File: streaming-delegate.ts    From homebridge-nest-cam with GNU General Public License v3.0 6 votes vote down vote up
private getOfflineImage(callback: SnapshotRequestCallback): void {
    const log = this.log;
    readFile(join(__dirname, `../images/offline.jpg`), (err, data) => {
      if (err) {
        log.error(err.message);
        callback(err);
      } else {
        callback(undefined, data);
      }
    });
  }
Example #12
Source File: bundle.ts    From codedoc with MIT License 6 votes vote down vote up
export function bundle(config: CodedocConfig, themeInstaller: TransportedFunc<void>) {
  const bundle = new Bundle(
    '/' + config.dest.bundle + '/codedoc-bundle.js',
    join(config.dest.assets, config.dest.bundle, 'codedoc-bundle.js')
  );
  bundle.init(initJss$);
  bundle.init(themeInstaller);

  config.bundle.init.forEach(init => bundle.init(init));

  bundle.withRenderer<any, any>(getRenderer$);
  return bundle;
}
Example #13
Source File: test.jest.testRunner.ts    From askql with MIT License 6 votes vote down vote up
async function runAgainstTestResultFile({
  testPath,
  name,
  runtime,
  askJsonTargetPath,
  environment,
  args,
  testResults,
}: AskScriptTestWithResultFileConfig) {
  const resultPath = join(testPath, `../${name}.test.result.ts`);
  if (existsSync(resultPath)) {
    const code = runtime.requireModule<AskCodeOrValue>(askJsonTargetPath);
    const result = await runUntyped(environment, code, args);
    const expectedResult = runtime.requireModule(resultPath);
    const isCorrect = compareAsJson(result, expectedResult);
    if ('ASK_PRINT_RESULT' in process.env && process.env.ASK_PRINT_RESULT) {
      console.log(`RESULT: ${JSON.stringify(result, null, 2)}`);
    }
    testResults.computes = assertionResult({
      status: isCorrect ? 'passed' : 'failed',
      title: 'produces the expected result',
      failureMessages: isCorrect
        ? []
        : [
            `EXPECTED: ${JSON.stringify(expectedResult, null, 2)}
    GOT: ${JSON.stringify(result, null, 2)}`,
          ],
    });
  }
}
Example #14
Source File: findAllFiles.spec.ts    From solc-typed-ast with Apache License 2.0 6 votes vote down vote up
samples: Array<[string, string[]]> = [
    [
        join(SAMPLES_DIR, "latest_08.sol"),
        [join(SAMPLES_DIR, "latest_08.sol"), join(SAMPLES_DIR, "latest_imports_08.sol")]
    ],
    [
        join(SAMPLES_DIR, "resolving", "imports_and_source_unit_function_overloading.sol"),
        [
            join(SAMPLES_DIR, "resolving", "imports_and_source_unit_function_overloading.sol"),
            join(SAMPLES_DIR, "resolving", "boo.sol"),
            join(SAMPLES_DIR, "resolving", "foo.sol")
        ]
    ],
    [
        join(SAMPLES_DIR, "resolving", "id_paths.sol"),
        [
            join(SAMPLES_DIR, "resolving", "id_paths.sol"),
            join(SAMPLES_DIR, "resolving", "id_paths_lib.sol"),
            join(SAMPLES_DIR, "resolving", "id_paths_lib2.sol")
        ]
    ],
    [
        join(SAMPLES_DIR, "meta", "complex_imports", "c.sol"),
        [
            join(SAMPLES_DIR, "meta", "complex_imports", "c.sol"),
            join(SAMPLES_DIR, "meta", "complex_imports", "b.sol"),
            join(SAMPLES_DIR, "meta", "complex_imports", "a.sol")
        ]
    ],
    [
        join(SAMPLES_DIR, "meta", "imports", "A.sol"),
        [
            join(SAMPLES_DIR, "meta", "imports", "A.sol"),
            join(SAMPLES_DIR, "meta", "imports", "lib", "B.sol"),
            join(SAMPLES_DIR, "meta", "imports", "lib2", "C.sol"),
            join(SAMPLES_DIR, "meta", "imports", "lib2", "D.sol")
        ]
    ]
]
Example #15
Source File: ActionManager.ts    From ts-discord-bot-boilerplate with MIT License 6 votes vote down vote up
/**
     * Parses files into commands from the configured command path.
     * @param {BotClient} client The original client, for access to the configuration.
     * @returns {Collection<string, Command>} A dictionary of every command in a [name, object] pair.
     */
    public initializeCommands(client: BotClient): void {
        const { commands } = client.settings.paths;

        readdir(commands, (err, files) => {
            if (err) Logger.error(err);

            files.forEach(cmd => {
                if (statSync(join(commands, cmd)).isDirectory()) {
                    this.initializeCommands(client);
                } else {
                    const Command: any = require(join(
                        __dirname,
                        '../../',
                        `${commands}/${cmd.replace('ts', 'js')}`
                    )).default;
                    const command = new Command(client);

                    this.commands.set(command.conf.name, command);
                }
            });
        });
    }
Example #16
Source File: paths.ts    From Cromwell with MIT License 6 votes vote down vote up
getCmsConfigPath = async (dir?: string) => {
    let confPath;
    const getUp = async (level: number) => {
        const dirPath = normalizePath(resolve(dir ?? process.cwd(),
            Array(level).fill('../').join('')));

        confPath = join(dirPath, cmsConfigFileName);
        if (! await fs.pathExists(confPath)
            && dirPath.split('/').filter(it => it !== '').length > 1) {
            await getUp(++level);
        }
    }
    await getUp(0);
    if (await fs.pathExists(confPath)) return confPath;
}
Example #17
Source File: app.module.ts    From nestjs-mercurius with MIT License 6 votes vote down vote up
@Module({
  imports: [
    CatsModule,
    MercuriusModule.forRoot({
      typePaths: [join(__dirname, '**', '*.graphql')],
    }),
  ],
})
export class ApplicationModule {}
Example #18
Source File: TestProject.ts    From yarn-plugins with MIT License 6 votes vote down vote up
public static async setup(): Promise<TestProject> {
    const dir = await tmp.dir();
    const pluginBundles = await globby('packages/*/bundles/**/*.js', {
      cwd: PROJECT_DIR,
    });
    const plugins = pluginBundles.map((src) => ({
      src,
      name: '@yarnpkg/' + basename(src, extname(src)),
      dest: posix.join('.yarn', 'plugins', ...src.split(sep).slice(3)),
    }));

    for (const path of plugins) {
      await copy(join(PROJECT_DIR, path.src), join(dir.path, path.dest));
    }

    const yarnConfig = safeLoad(
      await readFile(join(PROJECT_DIR, '.yarnrc.yml'), 'utf8'),
    ) as Record<string, unknown>;

    // Create .yarnrc.yml
    await outputFile(
      join(dir.path, '.yarnrc.yml'),
      safeDump({
        yarnPath: join(PROJECT_DIR, yarnConfig.yarnPath as string),
        plugins: plugins.map((plugin) => ({
          path: plugin.dest,
          spec: plugin.name,
        })),
      }),
    );

    // Create package.json
    await outputJSON(join(dir.path, 'package.json'), {
      private: true,
      workspaces: ['packages/*'],
    });

    return new TestProject(dir);
  }
Example #19
Source File: fixturedActions.test.ts    From dt-mergebot with MIT License 6 votes vote down vote up
/* You can use the following command to add/update fixtures with an existing PR
 *
 *     BOT_AUTH_TOKEN=XYZ npm run create-fixture -- 43164
 */

async function testFixture(dir: string) {
    // _foo.json are input files, except for Date.now from derived.json
    const responsePath = join(dir, "_response.json");
    const filesPath = join(dir, "_files.json");
    const downloadsPath = join(dir, "_downloads.json");
    const derivedPath = join(dir, "derived.json");
    const resultPath = join(dir, "result.json");
    const mutationsPath = join(dir, "mutations.json");

    const JSONString = (value: any) => scrubDiagnosticDetails(JSON.stringify(value, null, "  ") + "\n");

    const response: ApolloQueryResult<PR> = readJsonSync(responsePath);
    const files = readJsonSync(filesPath);
    const downloads = readJsonSync(downloadsPath);

    const prInfo = response.data.repository?.pullRequest;
    if (!prInfo) throw new Error("Should never happen");

    const derived = await deriveStateForPR(
        prInfo,
        (expr: string) => Promise.resolve(files[expr] as string),
        (name: string, _until?: Date) => name in downloads ? downloads[name] : 0,
        new Date(readJsonSync(derivedPath).now),
    );

    const action = process(derived);

    expect(JSONString(action)).toMatchFile(resultPath);
    expect(JSONString(derived)).toMatchFile(derivedPath);

    const mutations = await executePrActions(action, prInfo, /*dry*/ true);
    expect(JSONString(mutations)).toMatchFile(mutationsPath);
}
Example #20
Source File: angular-universal.adapter.ts    From nx-plugins with MIT License 6 votes vote down vote up
getApplicationTypeTemplate(): Rule {
    const buildTarget = this.project.targets.get('build') as TargetDefinition;
    return applyTemplates({
      getRootDirectory: () => '',
      buildPath: join(
        `../../../${(buildTarget.options as JsonObject).outputPath}`
      ),
      projectName: this.options.project
    });
  }
Example #21
Source File: check.ts    From a18n with MIT License 6 votes vote down vote up
getExistingResources = (
  localeRoot: string,
  locale: string,
): LocaleResource => {
  const filePath = join(localeRoot, `${locale}.json`)
  if (isFile(filePath)) {
    return importers.json(readFile(filePath))
  } else {
    return {}
  }
}
Example #22
Source File: storage-test-contract.test.ts    From fuels-ts with Apache License 2.0 6 votes vote down vote up
setup = async () => {
  const provider = new Provider('http://127.0.0.1:4000/graphql');
  // Create wallet
  const wallet = await TestUtils.generateTestWallet(provider, [[1_000, NativeAssetId]]);

  // Deploy contract
  const bytecode = readFileSync(join(__dirname, './out/debug/storage-test.bin'));
  const factory = new ContractFactory(bytecode, abi, wallet);
  const contract = await factory.deployContract();

  return contract;
}
Example #23
Source File: CacheHandler.ipc.ts    From Bridge with GNU General Public License v3.0 6 votes vote down vote up
/**
   * Deletes all the files under `tempPath`
   */
  async handler() {
    let files: Dirent[]
    try {
      files = await readdir(tempPath, { withFileTypes: true })
    } catch (err) {
      devLog('Failed to read cache: ', err)
      return
    }

    for (const file of files) {
      try {
        devLog(`Deleting ${file.isFile() ? 'file' : 'folder'}: ${join(tempPath, file.name)}`)
        await rimraf(join(tempPath, file.name))
      } catch (err) {
        devLog(`Failed to delete ${file.isFile() ? 'file' : 'folder'}: `, serializeError(err))
        return
      }
    }
  }
Example #24
Source File: fsScanning.ts    From gcov-viewer with MIT License 6 votes vote down vote up
/**
 * Calls the given callback with every found file path in the given directory.
 * Other implementations return all paths at once, but the progress can't be
 * reported in the ui. Furthermore, this function can be cancelled by the user
 * if it takes too long.
 */
export async function findAllFilesRecursively(directory: string, callback: (path: string) => void, token?: vscode.CancellationToken) {
    let fileNames: string[] = await readdirOrEmpty(directory);

    for (const fileName of fileNames) {
        const path = join(directory, fileName);
        const stats = await statsOrUndefined(path);
        if (stats === undefined) {
            continue;
        }
        if (stats.isFile()) {
            if (token?.isCancellationRequested) {
                return;
            }
            callback(path);
        }
        else {
            await findAllFilesRecursively(path, callback, token);
        }
    }
}
Example #25
Source File: iDeviceApplications.ts    From iOSreExtension with Apache License 2.0 6 votes vote down vote up
constructor(
        public readonly label: string,
        public isinSubContext: Boolean,
        public infoObject: Array<string>,
		public readonly collapsibleState: vscode.TreeItemCollapsibleState
	) {
        super(label, collapsibleState);
        this.tooltip = infoObject[1];
        this.iconPath = vscode.Uri.file(join(__filename,'..', '..' ,'res' ,'bundle.svg'));

        if (infoObject.length > 3) {
            let tryImageUri = vscode.Uri.parse(infoObject[3]);
            if (tryImageUri !== undefined && tryImageUri !== null) {
                this.iconPath = tryImageUri;
            }
        }
    }
Example #26
Source File: vite.config.ts    From nest-react with GNU Lesser General Public License v3.0 6 votes vote down vote up
// Commit information to identify the build
function getBuildId(): string {
  try {
    const versionPath = join(__dirname, '..', '..', 'VERSION');
    const versionData = readFileSync(versionPath)
      .toString()
      .split(/[\r\n]+/);
    const [, branch] = versionData
      .find(line => line.includes('GIT_BRANCH'))!
      .split('=');
    const [, shortHash] = versionData
      .find(line => line.includes('GIT_SHORT_HASH'))!
      .split('=');
    return `${shortHash}@${branch}`;
  } catch (err) {
    console.log(err);
    return 'no-git';
  }
}
Example #27
Source File: api.ts    From BloggerWeb with GNU General Public License v3.0 6 votes vote down vote up
export function getPostBySlug(slug: string, fields: string[] = []): PostItems {
  const realSlug = slug.replace(/\.mdx$/, '');
  const fullPath = join(POSTS_PATH, `${realSlug}.mdx`);
  const fileContents = fs.readFileSync(fullPath, 'utf8');
  const { data, content } = matter(fileContents);

  const items: PostItems = {};

  // Ensure only the minimal needed data is exposed
  fields.forEach((field) => {
    if (field === 'slug') {
      items[field] = realSlug;
    }
    if (field === 'content') {
      items[field] = content;
    }
    if (data[field]) {
      items[field] = data[field];
    }
  });

  return items;
}
Example #28
Source File: installRPackage.ts    From VSCode-R-Debugger with MIT License 6 votes vote down vote up
export async function updateRPackage(extensionPath: string, packageName:string = 'vscDebugger'): Promise<void> {
    const url = getRDownloadLink(packageName);
    const rPath = (await getRStartupArguments()).path.replace(/^"(.*)"$/, '$1');
    const taskDefinition: vscode.TaskDefinition = {
        type: 'process'
    };
    const args = [
        '--no-restore',
        '--quiet',
        '-f',
        `"${join(extensionPath, 'R', 'install.R')}"`,
        '--args',
        `"${url}"`
    ];
    const processExecution = new vscode.ProcessExecution(rPath, args);
    const installationTask = new vscode.Task(
        taskDefinition,
        vscode.TaskScope.Global,
        'Install vscDebugger',
        'R-Debugger',
        processExecution
    );
    
    const taskExecutionRunning = await vscode.tasks.executeTask(installationTask);
    
    const taskDonePromise = new Promise<void>((resolve) => {
        vscode.tasks.onDidEndTask(e => {
            if (e.execution === taskExecutionRunning) {
                resolve();
            }
        });
    });
    
    return await taskDonePromise;
}
Example #29
Source File: platform-user.test.ts    From F95API with MIT License 6 votes vote down vote up
export function suite(): void {
  it("Parse platform user data", async function () {
    // Arrange
    const path = join(__dirname, "..", "..", "resources", "platform-user-data.html");
    const html = await fs.readFile(path, { encoding: "utf-8", flag: "r" });

    // "Log-in" the user
    Shared.setIsLogged(true);

    // Rewire the "PlatformUser.ts" module overwritting the
    // "fetchHTML" function to return the custom HTML file
    const rewired = rewire("../../../../src/scripts/classes/mapping/platform-user");

    // Typescript transpile the code -> dist/**/platform-user.js
    rewired.__set__("network_helper_1.fetchHTML", () => success(html));

    // Use this to allow the creation of a class using "new"
    const RewiredPlatformUser = rewired.__get__("PlatformUser");

    // Act
    const FAKE_ID = 1000;
    const user: PlatformUser = new RewiredPlatformUser(FAKE_ID);
    await user.fetch();

    // Assert
    expect(user.avatar.includes("data/avatars/l/1470/1470797.jpg")).to.be.true;
    expect(user.banners.length).to.be.equal(0);
    expect(user.donation).to.be.equal(0);
    expect(user.messages).to.be.equal(53);
    expect(user.name).to.be.equal("MillenniumEarl");
    expect(user.points).to.be.equal(109);
    expect(user.private).to.be.false;
    expect(user.ratingsReceived).to.be.equal(1);
    expect(user.reactionScore).to.be.equal(44);
    expect(user.title).to.be.equal("Newbie");
  });
}