Detalhes do pacote

@comunica/utils-jest

comunica433MIT4.2.0

Jest utilities for Comunica

jest, rdf, comunica, testing

readme (leia-me)

Comunica Jest helpers

npm version

Jest test helpers for Comunica

This module is part of the Comunica framework, and should only be used by developers that want to build their own query engine.

Click here if you just want to query with Comunica.

Install

$ yarn add --save-dev @comunica/utils-jest

Configuration

In order to use matchers in your tests, you'll have to make sure that they are imported. This can be done by adding the following entry to your Jest configuration:

{
  "jest": {
    "setupFilesAfterEnv": ["@comunica/utils-jest"]
  }
}

If you are already using an existing test framework script file, make sure to add @comunica/utils-jest as follows to your file:

...
require('@comunica/utils-jest');

Optional: Typescript typings configuration

If you are using TypeScript, possibly in combination with ts-jest, you will need to import the typings of this package to make the TS compiler recognise the new matchers.

For this, include the following import at the top of each applicable test file:

import "@comunica/utils-jest";

API

All examples below make use of these helpers:

import { BindingsFactory } from '@comunica/utils-bindings-factory';
import { DataFactory } from 'rdf-data-factory';

const BF = new BindingsFactory(DF);
const DF = new DataFactory();

toEqualBindings

Check if two Bindings are equal.

expect(BF.bindings([
  [ DF.variable('a'), DF.namedNode('a1') ],
  [ DF.variable('b'), DF.namedNode('b1') ],
])).toEqualBindings(BF.bindings([
  [ DF.variable('a'), DF.namedNode('a1') ],
  [ DF.variable('b'), DF.namedNode('b1') ],
]));

toEqualBindingsArray

Check if two Bindings arrays are equal.

expect([
  BF.bindings([
    [ DF.variable('a'), DF.namedNode('a1') ],
    [ DF.variable('b'), DF.namedNode('b1') ],
  ]),
  BF.bindings([
    [ DF.variable('b'), DF.namedNode('b1') ],
    [ DF.variable('c'), DF.namedNode('c1') ],
  ]),
]).toEqualBindingsArray([
  BF.bindings([
    [ DF.variable('a'), DF.namedNode('a1') ],
    [ DF.variable('b'), DF.namedNode('b1') ],
  ]),
  BF.bindings([
    [ DF.variable('b'), DF.namedNode('b1') ],
    [ DF.variable('c'), DF.namedNode('c1') ],
  ]),
]);

toEqualBindingsStream

Check if a Bindings stream equals a Bindings array.

import { ArrayIterator } from 'asynciterator';

expect(new ArrayIterator([
  BF.bindings([
    [ DF.variable('a'), DF.namedNode('a1') ],
    [ DF.variable('b'), DF.namedNode('b1') ],
  ]),
  BF.bindings([
    [ DF.variable('b'), DF.namedNode('b1') ],
    [ DF.variable('c'), DF.namedNode('c1') ],
  ]),
], { autoStart: false })).toEqualBindingsStream([
  BF.bindings([
    [ DF.variable('a'), DF.namedNode('a1') ],
    [ DF.variable('b'), DF.namedNode('b1') ],
  ]),
  BF.bindings([
    [ DF.variable('b'), DF.namedNode('b1') ],
    [ DF.variable('c'), DF.namedNode('c1') ],
  ]),
]);

changelog (log de mudanças)

Changelog

All notable changes to this project will be documented in this file.

v4.2.0 - 2025-04-29

Added

Changed

Fixed

v4.1.0 - 2025-02-11

v4.1.0 - 2025-02-11

Added

Changed

Fixed

v4.0.2 - 2024-10-16

Changed

Fixed

v4.0.1 - 2024-10-15

BREAKING CHANGES

The following breaking changes will only impact users of Node.js < 18 and users that develop custom components or engines with Comunica.

Added

Changed

Fixed

v3.3.0 - 2024-10-08

Added

Changed

Fixed

v3.2.3 - 2024-08-22

Fixed

v3.2.2 - 2024-08-19

Changed

Fixed

v3.2.1 - 2024-08-07

Added

Changed

Fixed

v3.2.0 - 2024-07-05

Added

Changed

Fixed

v3.1.2 - 2024-05-30

Fixed

Changed

v3.1.1 - 2024-05-11

Fixed

v3.1.0 - 2024-05-11

Added

Changed

Fixed

v3.0.3 - 2024-04-12

Changed

Fixed

v3.0.2 - 2024-04-10

Fixed

v3.0.1 - 2024-03-19

BREAKING CHANGES

Added

Fixed

Changed

v2.10.2 - 2024-01-09

Fixed

v2.10.1 - 2023-11-29

Fixed

v2.10.0 - 2023-10-27

Added

Changed

Fixed

v2.9.0 - 2023-09-07

Changed

Fixed

v2.8.3 - 2023-08-21

Changed

Fixed

v2.8.2 - 2023-08-10

Fixed

v2.8.1 - 2023-07-14

Fixed

v2.8.0 - 2023-07-04

Added

Changed

v2.7.1 - 2023-05-31

Changed

Fixed

v2.7.0 - 2023-05-24

Added

Changed

Fixed

v2.6.10 - 2023-03-10

Fixed

v2.6.9 - 2023-03-08

Changed

Fixed

v2.6.8 - 2023-03-06

Changed

Fixed

v2.6.7 - 2023-02-15

Added

v2.6.6 - 2023-02-08

Fixed

Changed

v2.6.5 - 2023-02-07

Fixed

v2.6.4 - 2023-02-02

Fixed

v2.6.3 - 2023-02-01

Fixed

v2.6.2 - 2023-01-31

Fixed

v2.6.1 - 2023-01-30

Fixed

v2.6.0 - 2023-01-26

Added

Changed

Fixed

v2.5.2 - 2022-11-18

Fixed

v2.5.1 - 2022-11-16

Fixed

v2.5.0 - 2022-11-09

Added

Changed

Fixed

v2.4.3 - 2022-09-06

Fixed

v2.4.2 - 2022-08-26

Fixed

v2.4.1 - 2022-08-24

Fixed

v2.4.0 - 2022-08-24

Added

Changed

Fixed

v2.3.0 - 2022-06-29

Added

Changed

Fixed

v2.2.1 - 2022-04-13

Fixed

v2.2.0 - 2022-04-12

Added

Changed

Fixed

v2.1.0 - 2022-03-09

Added

v2.0.6 - 2022-03-07

Fixed

v2.0.5 - 2022-03-04

Fixed

v2.0.4 - 2022-03-04

Fixed

v2.0.3 - 2022-03-02

Fixed

v2.0.2 - 2022-03-02

Fixed

v2.0.1 - 2022-03-02

BREAKING CHANGES

Added

Changed

v1.22.3 - 2021-10-19

Fixed

v1.22.2 - 2021-09-30

Changed

Fixed

v1.22.1 - 2021-09-22

Fixed

v1.22.0 - 2021-08-30

Added

Changed

Fixed

v1.21.3 - 2021-06-18

Fixed

v1.21.2 - 2021-06-14

Changed

v1.21.1 - 2021-04-27

Republish due to npm publishing failure of 1.21.0.

v1.21.0 - 2021-04-27

Added

Changed

Fixed

v1.20.0 - 2021-03-30

Added

Changed

Fixed

v1.19.2 - 2021-02-02

Changed

Fixed

v1.19.1 - 2021-01-22

Fixed

v1.19.0 - 2021-01-15

Changed

v1.18.1 - 2020-12-01

Fixed

v1.18.0 - 2020-11-02

Fixed

Added

Changed

v1.17.0 - 2020-09-25

Added

Changed

Fixed

v1.16.2 - 2020-08-24

Fixed

v1.16.1 - 2020-08-24

Fixed

v1.16.0 - 2020-08-24

Added

Fixed

Changed

v1.15.0 - 2020-08-13

Added

Changed

Fixed

v1.14.0 - 2020-07-24

Added

Changed

Fixed

v1.13.1 - 2020-06-11

Fixed

v1.13.0 - 2020-06-03

Fixed

Changed

v1.12.1 - 2020-04-27

Fixed

v1.12.0 - 2020-04-03

Changed

Added

Fixed

v1.11.1 - 2020-04-02

Added

Fixed

Changed

v1.11.0 - 2020-03-30

Added

Changed

Fixed

v1.10.0 - 2019-12-12

Added

Changed

Fixed

v1.9.4 - 2019-10-21

Changed

v1.9.3 - 2019-10-16

Added

Changed

Fixed

v1.9.2 - 2019-09-27

Added

Changed

Fixed

v1.9.1 - 2019-07-30

Fixed

v1.9.0 - 2019-07-29

Added

Fixed

Changed

v1.8.0 - 2019-06-13

Changed

v1.7.4 - 2019-05-29

Fixed

v1.7.3 - 2019-05-09

Fixed

v1.7.2 - 2019-05-03

Fixed

v1.7.1 - 2019-05-03

Fixed

Changed

v1.7.0 - 2019-04-11

Added

Fixed

v1.6.6 - 2019-04-03

Changed

Fixed

v1.6.5 - 2019-03-15

Added

Fixed

v1.6.4 - 2019-03-05

Fixed

v1.6.3 - 2019-02-27

Changed

v1.6.2 - 2019-02-26

Added

Changed

v1.6.1 - 2019-02-25

Fixed

v1.6.0 - 2019-02-22

Added

Changed

Fixed

v1.5.4 - 2019-01-31

Fixed

Changed

v1.5.3 - 2019-01-24

Fixed

v1.5.2 - 2019-01-17

Fixed

v1.5.1 - 2019-01-17

Fixed

v1.5.0 - 2019-01-02

Added

v1.4.6 - 2018-12-11

Fixed

v1.4.5 - 2018-12-11

Fixed

Changed

v1.4.4 - 2018-11-13

Fixed

v1.4.3 - 2018-11-09

Changed

v1.4.2 - 2018-11-05

Fixed

v1.4.1 - 2018-10-04

Fixed

v1.4.0 - 2018-10-03

Added

Fixed

1.3.0 - 2018-09-10

Added

1.2.2 - 2018-09-05

Fixes

1.2.1 - 2018-09-05

Fixes

1.2.0 - 2018-09-05

Added

Fixes

1.1.2 - 2018-06-26

Added

Fixes

1.1.1 - 2018-06-01

Fixes

1.1.0 - 2018-06-01

Added

Fixes

1.0.4 - 2018-03-22

Fixes

1.0.3 - 2018-03-22

Fixes

1.0.2 - 2018-03-22

Fixes

1.0.1 - 2018-03-21

Fixes

[1.0.0] - 2018-03-19

  • Initial release