refactor: clean up VariableModel. (#8416)

This commit is contained in:
Aaron Dodson
2024-07-22 10:51:56 -07:00
committed by GitHub
parent 21c0a7d999
commit 26e6d80e15
2 changed files with 43 additions and 22 deletions

View File

@@ -27,9 +27,9 @@ suite('Variable Model', function () {
'test_type',
'test_id',
);
assert.equal(variable.name, 'test');
assert.equal(variable.type, 'test_type');
assert.equal(variable.id_, 'test_id');
assert.equal(variable.getName(), 'test');
assert.equal(variable.getType(), 'test_type');
assert.equal(variable.getId(), 'test_id');
});
test('Null type', function () {
@@ -39,7 +39,7 @@ suite('Variable Model', function () {
null,
'test_id',
);
assert.equal(variable.type, '');
assert.equal(variable.getType(), '');
});
test('Undefined type', function () {
@@ -49,7 +49,7 @@ suite('Variable Model', function () {
undefined,
'test_id',
);
assert.equal(variable.type, '');
assert.equal(variable.getType(), '');
});
test('Null id', function () {
@@ -59,9 +59,9 @@ suite('Variable Model', function () {
'test_type',
null,
);
assert.equal(variable.name, 'test');
assert.equal(variable.type, 'test_type');
assert.exists(variable.id_);
assert.equal(variable.getName(), 'test');
assert.equal(variable.getType(), 'test_type');
assert.exists(variable.getId());
});
test('Undefined id', function () {
@@ -71,15 +71,15 @@ suite('Variable Model', function () {
'test_type',
undefined,
);
assert.equal(variable.name, 'test');
assert.equal(variable.type, 'test_type');
assert.exists(variable.id_);
assert.equal(variable.getName(), 'test');
assert.equal(variable.getType(), 'test_type');
assert.exists(variable.getId());
});
test('Only name provided', function () {
const variable = new Blockly.VariableModel(this.workspace, 'test');
assert.equal(variable.name, 'test');
assert.equal(variable.type, '');
assert.exists(variable.id_);
assert.equal(variable.getName(), 'test');
assert.equal(variable.getType(), '');
assert.exists(variable.getId());
});
});