
Research
Two Malicious Rust Crates Impersonate Popular Logger to Steal Wallet Keys
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
@star-unit/js
Advanced tools
A lightweight tool for instant JavaScript unit testing.
npm install @star-unit/js
Initialize configuration:
npx suj init
Run tests:
npx suj test
Note: After installation, the CLI is available via the
suj
command.
describe
, test
, expect
)..not
negations.init
Initialize the configuration required by this tool.
Options:
-r, --root <root>
— Path to the root directory (default: "./"
).test
Run unit tests.
Options:
describe(description, fn)
Groups related tests together.
describe("Math operations", () => {
// tests here
});
test(description, fn)
Defines a single unit test.
test("adds numbers correctly", () => {
const result = 1 + 2;
expect(result).toBe(3);
});
expect(actual)
Starts an assertion chain for a test result.
expect(4).toBe(4);
expect(4).not.toBe(5);
You can chain .not
to invert the matcher logic.
Matchers are used to assert specific conditions. Each matcher has a .not
version that inverts its logic.
Matcher | Description | .not Version |
---|---|---|
.toBe(expected) | Value is exactly equal (=== ) | Value is not exactly equal |
.toEqual(expected) | Values are deeply equal | Values are not deeply equal |
.toThrow(expected?) | Function throws error | Function does not throw |
.toBeGreaterThan(expected) | Greater than comparison | Not greater than |
.toBeLessThan(expected) | Less than comparison | Not less than |
.toBeNull() | Value is null | Value is not null |
.toBeTruthy() | Value is truthy (!!value === true ) | Value is not truthy |
const { describe, test, expect } = require("@star-unit/js");
describe("Array methods", () => {
test("push adds an item", () => {
const arr = [];
arr.push(1);
expect(arr.length).toBe(1);
expect(arr[0]).toBe(1);
});
test("pop removes the last item", () => {
const arr = [1, 2, 3];
const last = arr.pop();
expect(last).toBe(3);
expect(arr.length).toBe(2);
});
test("pop should not add elements", () => {
const arr = [1, 2, 3];
arr.pop();
expect(arr.length).not.toBe(3);
});
});
ISC License.
FAQs
> A lightweight tool for instant JavaScript unit testing.
The npm package @star-unit/js receives a total of 0 weekly downloads. As such, @star-unit/js popularity was classified as not popular.
We found that @star-unit/js demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovers malicious Rust crates impersonating fast_log to steal Solana and Ethereum wallet keys from source code.
Research
A malicious package uses a QR code as steganography in an innovative technique.
Research
/Security News
Socket identified 80 fake candidates targeting engineering roles, including suspected North Korean operators, exposing the new reality of hiring as a security function.