Files
blockly/tests/mocha/procedure_map_test.js
dependabot[bot] 8873e5fe7a chore(deps): bump chai from 5.2.1 to 6.0.1 (#9330)
* chore(deps): bump chai from 5.2.1 to 6.0.1

Bumps [chai](https://github.com/chaijs/chai) from 5.2.1 to 6.0.1.
- [Release notes](https://github.com/chaijs/chai/releases)
- [Changelog](https://github.com/chaijs/chai/blob/main/History.md)
- [Commits](https://github.com/chaijs/chai/compare/v5.2.1...v6.0.1)

---
updated-dependencies:
- dependency-name: chai
  dependency-version: 6.0.1
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: Fix Chai import path.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Aaron Dodson <adodson@google.com>
2025-08-26 09:08:01 -07:00

53 lines
1.6 KiB
JavaScript

/**
* @license
* Copyright 2022 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
import {assert} from '../../node_modules/chai/index.js';
import {MockProcedureModel} from './test_helpers/procedures.js';
import {
sharedTestSetup,
sharedTestTeardown,
} from './test_helpers/setup_teardown.js';
suite('Procedure Map', function () {
setup(function () {
sharedTestSetup.call(this);
this.workspace = new Blockly.Workspace();
this.procedureMap = this.workspace.getProcedureMap();
});
teardown(function () {
sharedTestTeardown.call(this);
});
suite('publishing', function () {
test('inserting a procedure tells it to start publishing', function () {
const procedureModel = new MockProcedureModel();
const spy = sinon.spy(procedureModel, 'startPublishing');
this.procedureMap.set(procedureModel.getId(), procedureModel);
assert.isTrue(spy.called, 'Expected the model to start publishing');
});
test('adding a procedure tells it to start publishing', function () {
const procedureModel = new MockProcedureModel();
const spy = sinon.spy(procedureModel, 'startPublishing');
this.procedureMap.add(procedureModel);
assert.isTrue(spy.called, 'Expected the model to start publishing');
});
test('deleting a procedure tells it to stop publishing', function () {
const procedureModel = new MockProcedureModel();
const spy = sinon.spy(procedureModel, 'stopPublishing');
this.procedureMap.add(procedureModel);
this.procedureMap.delete(procedureModel.getId());
assert.isTrue(spy.calledOnce, 'Expected the model stop publishing');
});
});
});