Unverified Commit af006a2b authored by Mark Stenglein's avatar Mark Stenglein
Browse files

Parameters: organize parameters into directory



This commit moves all the parameters and their test cases to make it so
they are not a jumbled mess of files as they were before.
Signed-off-by: Mark Stenglein's avatarMark Stenglein <mark@stengle.in>
parent 3c8adb25
Pipeline #1229 passed with stage
in 42 seconds
......@@ -35,3 +35,4 @@ tags
coverage/
.#*.ts
......@@ -17,7 +17,7 @@
*/
import { isAlpha } from "./util";
import { ICalElement } from "./ICalElement";
import Parameter from "./Parameter";
import Parameter from "./Parameter/Parameter";
const CRLF: string = "\r\n";
/**
......
......@@ -20,7 +20,7 @@ import * as url from "url";
const URL = url.URL;
/**
* DelegatorsParam Class (Chapter 3.2.4)
* DirEntryRef Class (Chapter 3.2.4)
*
* - Purpose: To specify reference to a directory entry associated with the
* calendar user specified by the property.
......@@ -47,7 +47,7 @@ const URL = url.URL;
* @since 0.1.0
* @author Mark Stenglein <mark@stengle.in>
*/
export default class DirectoryEntryReference extends Parameter {
export default class DirEntryRef extends Parameter {
/** @access private */
public _uri: url.URL;
......
......@@ -15,8 +15,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import { isAlpha } from "./util";
import { ICalElement } from "./ICalElement";
import { isAlpha } from "../util";
import { ICalElement } from "../ICalElement";
/**
* Implementation of a Content Line Parameter from RFC 5545
......
......@@ -16,7 +16,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import ContentLine from "../src/ContentLine";
import Parameter from "../src/Parameter";
import Parameter from "../src/Parameter/Parameter";
import { expect } from "chai";
import "mocha";
......
......@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import AltRepParam from "../src/AltRepParam";
import AltRepParam from "../../src/Parameter/AltRepParam";
import { expect } from "chai";
import "mocha";
......
......@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import CalUserTypeParam from "../src/CalUserTypeParam";
import CalUserTypeParam from "../../src/Parameter/CalUserTypeParam";
import { expect } from "chai";
import "mocha";
......
......@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import CommonNameParam from "../src/CommonNameParam";
import CommonNameParam from "../../src/Parameter/CommonNameParam";
import { expect } from "chai";
import "mocha";
......@@ -76,4 +76,4 @@ describe("CommonNameParam", () => {
expect(param.generate()).to.equal(expected);
});
});
});
\ No newline at end of file
});
......@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import DelegateesParam from "../src/DelegateesParam";
import DelegateesParam from "../../src/Parameter/DelegateesParam";
import { expect } from "chai";
import "mocha";
......
......@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import DelegatorsParam from "../src/DelegatorsParam";
import DelegatorsParam from "../../src/Parameter/DelegatorsParam";
import { expect } from "chai";
import "mocha";
......
......@@ -15,28 +15,28 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import DirectoryEntryReference from "../src/DirectoryEntryReference";
import DirEntryRef from "../../src/Parameter/DirEntryRef";
import { expect } from "chai";
import "mocha";
/**
* Test the DelegatorsParam class.
* Test the DirEntryRef class.
*/
describe("DirectoryEntryReference:", () => {
describe("DirEntryRef:", () => {
it("Should exist", () => {
expect(DirectoryEntryReference).to.exist;
expect(DirEntryRef).to.exist;
});
describe("constructor:", () => {
it("should create an object", () => {
const param = new DirectoryEntryReference("ldap://valid.com:444");
const param = new DirEntryRef("ldap://valid.com:444");
expect(param).to.exist;
});
it("should complain on empty uri", () => {
expect(() => {
const param = new DirectoryEntryReference("");
const param = new DirEntryRef("");
}).to.throw("uri must be defined for DirectoryEntryReference");
});
});
......@@ -46,7 +46,7 @@ describe("DirectoryEntryReference:", () => {
it("should properly set the URI and give the same return", () => {
const URI = "ldap://me@example.com:6666/0=ABC%20Industries,c=US???"
+ "(cn=Jim%20Dolittle)";
const param = new DirectoryEntryReference(URI);
const param = new DirEntryRef(URI);
param.uri = URI;
expect(param.uri).to.be.equal(URI);
......@@ -56,14 +56,14 @@ describe("DirectoryEntryReference:", () => {
it("leading dash", () => {
expect(() => {
const URI = "-invalid://example.com:66/t/e/s/t";
const param = new DirectoryEntryReference(URI);
const param = new DirEntryRef(URI);
}).to.throw("Invalid URL");
});
it("space", () => {
expect(() => {
const URI = "in valid://example.com:66/t/e/s/t";
const param = new DirectoryEntryReference(URI);
const param = new DirEntryRef(URI);
}).to.throw("Invalid URL");
});
......@@ -75,14 +75,14 @@ describe("DirectoryEntryReference:", () => {
it("generates properly", () => {
const URI = "ldap://example.com:6666/o=ABC%20Industries,c=US???"
+ "(cn=Jim%20Dolittle)";
const param = new DirectoryEntryReference(URI);
const param = new DirEntryRef(URI);
expect(param.generate()).to.equal(`DIR="${URI}"`);
});
it("escapes spaces and other special chars", () => {
const URI = "http://example.com/test/with/a space/inside";
const param = new DirectoryEntryReference(URI);
const param = new DirEntryRef(URI);
const expectedURI = "http://example.com/test/with/a%20space/inside";
expect(param.generate()).to.equal(`DIR="${expectedURI}"`);
......
......@@ -15,7 +15,7 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import Parameter from "../src/Parameter";
import Parameter from "../../src/Parameter/Parameter";
import { expect } from "chai";
import "mocha";
......@@ -472,4 +472,4 @@ describe("Parameter", () => {
});
});
});
});
\ No newline at end of file
});
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment