Files
blockly/tests/mocha/variable_model_test.js
dependabot[bot] 2546b01d70 chore(deps): Bump prettier from 2.8.8 to 3.0.0 (#7322)
* chore(deps): Bump prettier from 2.8.8 to 3.0.0

Bumps [prettier](https://github.com/prettier/prettier) from 2.8.8 to 3.0.0.
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/2.8.8...3.0.0)

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

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

* chore: Reformat using Prettier v3.0 defaults

The main change is to add trailing commas to the last line of
block-formatted function calls.

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Christopher Allen <cpcallen+git@google.com>
2023-07-25 14:56:10 +00:00

87 lines
2.0 KiB
JavaScript

/**
* @license
* Copyright 2020 Google LLC
* SPDX-License-Identifier: Apache-2.0
*/
goog.declareModuleId('Blockly.test.variableModel');
import {
sharedTestSetup,
sharedTestTeardown,
} from './test_helpers/setup_teardown.js';
suite('Variable Model', function () {
setup(function () {
sharedTestSetup.call(this);
this.workspace = new Blockly.Workspace();
});
teardown(function () {
sharedTestTeardown.call(this);
});
test('Trivial', function () {
const variable = new Blockly.VariableModel(
this.workspace,
'test',
'test_type',
'test_id',
);
chai.assert.equal(variable.name, 'test');
chai.assert.equal(variable.type, 'test_type');
chai.assert.equal(variable.id_, 'test_id');
});
test('Null type', function () {
const variable = new Blockly.VariableModel(
this.workspace,
'test',
null,
'test_id',
);
chai.assert.equal(variable.type, '');
});
test('Undefined type', function () {
const variable = new Blockly.VariableModel(
this.workspace,
'test',
undefined,
'test_id',
);
chai.assert.equal(variable.type, '');
});
test('Null id', function () {
const variable = new Blockly.VariableModel(
this.workspace,
'test',
'test_type',
null,
);
chai.assert.equal(variable.name, 'test');
chai.assert.equal(variable.type, 'test_type');
chai.assert.exists(variable.id_);
});
test('Undefined id', function () {
const variable = new Blockly.VariableModel(
this.workspace,
'test',
'test_type',
undefined,
);
chai.assert.equal(variable.name, 'test');
chai.assert.equal(variable.type, 'test_type');
chai.assert.exists(variable.id_);
});
test('Only name provided', function () {
const variable = new Blockly.VariableModel(this.workspace, 'test');
chai.assert.equal(variable.name, 'test');
chai.assert.equal(variable.type, '');
chai.assert.exists(variable.id_);
});
});