Skip to content

Commit

Permalink
Add a private mock meter.
Browse files Browse the repository at this point in the history
  • Loading branch information
mattcollier committed Jul 17, 2023
1 parent 4613a3b commit 352dd1b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# bedrock-meter ChangeLog

## 5.2.0 - 2023-07-xx

### Added
- Add a private mock meter that can be used for development in private
application repositories.

## 5.1.1 - 2022-11-16

### Fixed
Expand Down
11 changes: 10 additions & 1 deletion lib/mocks/dev-meters.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* Copyright (c) 2021-2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2021-2023 Digital Bazaar, Inc. All rights reserved.
*/
import * as bedrock from '@bedrock/core';
import * as meters from '../meters.js';
Expand All @@ -13,6 +13,15 @@ const mockMeters = [{
product: {id: 'urn:uuid:80a82316-e8c2-11eb-9570-10bf48838a29'},
// default WebKMS id, from br-app-identity
serviceId: 'did:key:z6MkwZ7AXrDpuVi5duY2qvVSx1tBkGmVnmRjDvvwzoVnAzC4'
}, {
// stable multibase id
id: 'z19qxQFUcW438uJsNuQwZKQMc',
// application id used in private application repositories
controller: 'did:key:z6MkqiqpC8F46164m2w7fprNoqd3XK1jZniP5GMG3fmsADvv',
// default product id for Example WebKMS Product
product: {id: 'urn:uuid:80a82316-e8c2-11eb-9570-10bf48838a29'},
// default WebKMS id, from br-app-identity
serviceId: 'did:key:z6MkwZ7AXrDpuVi5duY2qvVSx1tBkGmVnmRjDvvwzoVnAzC4'
}];

bedrock.events.on('bedrock-mongodb.ready', async () => {
Expand Down
10 changes: 8 additions & 2 deletions test/mocha/20-mock-meter.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,21 @@
/*!
* Copyright (c) 2021-2022 Digital Bazaar, Inc. All rights reserved.
* Copyright (c) 2021-2023 Digital Bazaar, Inc. All rights reserved.
*/
import {meters} from '@bedrock/meter';

describe('add mock meter (config.meter.addMockMeters)', () => {
describe('get mock meter', () => {
it('should get mock meter', async () => {
it('should get the public mock meter', async () => {
const id = 'z19ygjQcNmQ9AbG7hCF39Kizs';
const {meter} = await meters.get({id});
should.exist(meter);
meter.id.should.equal(id);
});
it('should get the private mock meter', async () => {
const id = 'z19qxQFUcW438uJsNuQwZKQMc';
const {meter} = await meters.get({id});
should.exist(meter);
meter.id.should.equal(id);
});
});
});

0 comments on commit 352dd1b

Please sign in to comment.