google-test-utils
v0.3.1
Published
Testing utilities for Google Cloud client libraries
Downloads
8,178
Maintainers
Readme
Google Test Utilities: Node.js
Testing utilities for Google Cloud client libraries.
A comprehensive list of changes in each version may be found in the CHANGELOG.
Table of contents:
Quickstart
Installing the library
npm install google-test-utilsIt's unlikely you will need to install this package directly, as it is intended as an internal testing utility across Google Cloud Node.js client libraries.
Using the library
import * as assert from 'node:assert';
import {
TestResources,
assertArraySubclassStrictEqual,
isBun,
isNode,
isReadOnlyPropertyError,
} from 'google-test-utils';
const testResources = new TestResources('my-test-suite');
const resourceName = testResources.generateName('my-test');
// Runtime-agnostic frozen object mutation check (V8 / Node.js & JSC / Bun)
const frozen = Object.freeze({name: 'value'});
assert.throws(() => {
(frozen as {name: string}).name = 'updated';
}, err => isReadOnlyPropertyError(err, 'name'));
// Runtime-agnostic Array subclass strict equality check
assertArraySubclassStrictEqual(rowInstance, expectedRow);Supported Node.js Versions
This library is not publicly supported.
Versioning
This library follows Semantic Versioning.
Contributing
Contributions welcome! See the Contributing Guide.
License
Apache Version 2.0
See LICENSE
