This package has been deprecated

Author message:

This package is no longer maintained

@technologiestiftung/stadtpuls-test-utils
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

Version Documentation Maintenance License: MIT

Welcome to stadtpuls-test-utils

This repo contains shared test utilities for the stadtpuls project.

Prerequisites

  • node >=14

Install

npm i @technologiestiftung/stadtpuls-test-utils

Usage

Commonjs

//@ts-check
const {
  closePool,
  openPool,
  getClient,
  execQuery,
} = require("@technologiestiftung/stadtpuls-test-utils");

async function main() {
  await openPool("postgres://postgres:postgres@localhost:5432/postgres");
  const client = await getClient();
  await client.query(
    "CREATE TABLE IF NOT EXISTS test (id serial PRIMARY KEY, name varchar(255))"
  );
  await client.query("INSERT INTO test (name) VALUES ($1)", ["foo"]);
  const result = await client.query("SELECT * FROM test", []);
  // @ts-ignore
  console.log(result.rows);
  await closePool();
}
main().catch(console.error);

Typescript & ESM

import {
  closePool,
  openPool,
  getClient,
  execQuery,
} from "@technologiestiftung/stadtpuls-test-utils";

async function main() {
  await openPool("postgres://postgres:postgres@localhost:5432/postgres");
  const client = await getClient();
  await client.query(
    "CREATE TABLE IF NOT EXISTS test (id serial PRIMARY KEY, name varchar(255))"
  );
  await client.query("INSERT INTO test (name) VALUES ($1)", ["foo"]);
  const result = await client.query("SELECT * FROM test", []);
  // @ts-ignore
  console.log(result.rows);
  await closePool();
}
main().catch(console.error);

Run tests

npm test

Maintainers

License

Copyright © 2022 Technologiestiftung Berlin & Fabian Morón Zirfas.
This project is MIT licensed.

Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page. You can also take a look at the contributing guide.

Contributors

Thanks goes to these wonderful people (emoji key):


Fabian Morón Zirfas

💻 📖 🎨

Lucas Vogel

📖

This project follows the all-contributors specification. Contributions of any kind welcome!

Credits



A project by:

Supported by:

/@technologiestiftung/stadtpuls-test-utils/

    Package Sidebar

    Install

    npm i @technologiestiftung/stadtpuls-test-utils

    Weekly Downloads

    57

    Version

    1.0.4

    License

    MIT

    Unpacked Size

    37.5 kB

    Total Files

    36

    Last publish

    Collaborators

    • dnsos
    • fabian.moron.zirfas
    • juliazet
    • seb_meier
    • tsboter
    • vogelino