I have to write a function that simplifies a scope expression. I already have a set of tests to test the function. I am very new to TDD.
Here are my tests:
test('single scope simplifies to itself', function() {
assert.equal(simplifyScopeExpression("scope:1"), "scope:1");
});
test('AnyOf simplifies to itself', function() {
assert.equal(
simplifyScopeExpression({AnyOf: ["scope:1", "scope:2"]}),
{AnyOf: ["scope:1", "scope:2"]});
});
test('AllOf simplifies to itself', function() {
assert.equal(
simplifyScopeExpression({AllOf: ["scope:1", "scope:2"]}),
{AllOf: ["scope:1", "scope:2"]});
});
Here is a function that I wrote to simplify the first test, I am not sure if its right but it passes the first test. The function should return a scope expression.
const assert = require("assert");
exports.simplifyScopeExpression = (scope1,scope2) => {
assert.deepEqual(scope1,scope2)
return scope1
}
Aucun commentaire:
Enregistrer un commentaire