Missed a couple of changes for js-preserves2

This commit is contained in:
Tony Garnock-Jones 2024-04-04 15:46:19 +02:00
parent 1708274401
commit 29959c055e
1 changed files with 3 additions and 3 deletions

View File

@ -1,12 +1,12 @@
/// SPDX-License-Identifier: GPL-3.0-or-later
/// SPDX-FileCopyrightText: Copyright © 2016-2024 Tony Garnock-Jones <tonyg@leastfixedpoint.com>
import { KeyedSet } from '@preserves/core';
import { GenericEmbedded, KeyedSet } from '@preserves/core';
import { Bag, ChangeDescription } from '../src/runtime/bag';
describe('bag', () => {
it('should be initializable from a set', () => {
const b = new Bag(new KeyedSet<string>(['a', 'b', 'c']));
const b = new Bag(new KeyedSet<GenericEmbedded, string>(['a', 'b', 'c']));
expect(b.size).toBe(3);
expect(b.get('a')).toBe(1);
expect(b.get('z')).toBe(0);
@ -28,7 +28,7 @@ describe('bag', () => {
});
it('should count down', () => {
const b = new Bag(new KeyedSet<string>(['a']));
const b = new Bag(new KeyedSet<GenericEmbedded, string>(['a']));
expect(b.change('a', 1)).toBe(ChangeDescription.PRESENT_TO_PRESENT);
expect(b.change('a', -1)).toBe(ChangeDescription.PRESENT_TO_PRESENT);
expect(b.size).toBe(1);