@digitransit-search-util/digitransit-search-util-get-label 1.0.5 → 1.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +11 -17
  2. package/package.json +6 -5
  3. package/test.js +27 -8
package/README.md CHANGED
@@ -1,21 +1,21 @@
1
- # @digitransit-search-util/get-label
1
+ # @digitransit-search-util/digitransit-search-util-get-label
2
2
 
3
- # getLabel
3
+ <!-- Generated by documentation.js. Update this documentation by updating the source code. -->
4
4
 
5
- <DESCRIPTION>
5
+ ## getLabel
6
6
 
7
- **Parameters**
8
- <PARAMETERS>
7
+ Returns label for properties
9
8
 
10
- **Examples**
9
+ ### Parameters
11
10
 
12
- <!-- This file is automatically generated. Please don't edit it directly:
13
- if you find an error, edit the source file (likely index.js), and re-run
14
- ./scripts/generate-readmes in the digitransit-search-util project. -->
11
+ * `properties` **any** object
15
12
 
13
+ Returns **[Boolean][1]** true/false
14
+
15
+ [1]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean
16
16
  ---
17
17
 
18
- This module is part of the Digitransit project. It is maintained in the
18
+ This module is part of the Digitransit-ui project. It is maintained in the
19
19
  [HSLdevcom/digitransit-ui](https://github.com/HSLdevcom/digitransit-ui) repository, where you can create
20
20
  PRs and issues.
21
21
 
@@ -24,11 +24,5 @@ PRs and issues.
24
24
  Install this module individually:
25
25
 
26
26
  ```sh
27
- $ npm install @digitransit-search-util/get-label
28
- ```
29
-
30
- Or install the digitransit-search-util module that includes it as a function:
31
-
32
- ```sh
33
- $ npm install @digitransit-search-util/digitransit-search-util
27
+ $ npm install @digitransit-search-util/digitransit-search-util-get-label
34
28
  ```
package/package.json CHANGED
@@ -1,14 +1,15 @@
1
1
  {
2
2
  "name": "@digitransit-search-util/digitransit-search-util-get-label",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "digitransit-search-util get-label module",
5
5
  "main": "index.js",
6
+ "type": "module",
6
7
  "publishConfig": {
7
8
  "access": "public"
8
9
  },
9
10
  "scripts": {
10
- "test": "mocha -r esm test.js",
11
- "docs": "node -r esm ../../scripts/generate-readmes"
11
+ "test": "vitest run --config ../../../config/vitest.config.js \"$PWD/test.js\"",
12
+ "docs": "node ../../../scripts/workspace-packages/generate-readmes.mjs"
12
13
  },
13
14
  "repository": {
14
15
  "type": "git",
@@ -21,7 +22,7 @@
21
22
  "author": "Digitransit Authors",
22
23
  "license": "(AGPL-3.0 OR EUPL-1.2)",
23
24
  "dependencies": {
24
- "@digitransit-search-util/digitransit-search-util-uniq-by-label": "^2.1.3"
25
+ "@digitransit-search-util/digitransit-search-util-uniq-by-label": "^2.1.4"
25
26
  },
26
- "gitHead": "939d1d4a44ac0a04872e90b5ef1d8c92559f597c"
27
+ "gitHead": "3ea16b8aa7ff98fa4d58f72aed40ac0cda27c85f"
27
28
  }
package/test.js CHANGED
@@ -1,12 +1,31 @@
1
- /* eslint-disable import/no-extraneous-dependencies */
2
- import { expect } from 'chai';
3
- import { describe, it } from 'mocha';
4
- // eslint-disable-next-line no-unused-vars
5
- import getLabel from '.';
1
+ import { describe, it, expect } from 'vitest';
2
+ import getLabel from './index.js';
6
3
 
7
4
  describe('Testing @digitransit-search-util/digitransit-search-util-get-label module', () => {
8
- it('Checking that true is true', () => {
9
- // const retValue = getLabel(param1, param2);
10
- expect(true).to.be.equal(true);
5
+ it('joins name and address for a plain address suggestion', () => {
6
+ const label = getLabel({
7
+ layer: 'address',
8
+ name: 'Mannerheimintie 1',
9
+ label: 'Mannerheimintie 1, Helsinki',
10
+ });
11
+ expect(label).toBe('Mannerheimintie 1, Helsinki');
12
+ });
13
+
14
+ it('returns only the address for a current-position suggestion', () => {
15
+ const label = getLabel({
16
+ layer: 'currentPosition',
17
+ labelId: 'use-own-position',
18
+ address: 'My location',
19
+ });
20
+ expect(label).toBe('My location');
21
+ });
22
+
23
+ it('returns only the name for a favourite place', () => {
24
+ const label = getLabel({
25
+ layer: 'favouritePlace',
26
+ name: 'Home',
27
+ address: 'Home, Helsinki',
28
+ });
29
+ expect(label).toBe('Home');
11
30
  });
12
31
  });