2017-01-18 22:27:19 +08:00
|
|
|
"use strict";
|
|
|
|
|
2025-07-03 17:06:45 +08:00
|
|
|
const path = require("path");
|
2017-01-18 22:27:19 +08:00
|
|
|
const RawModule = require("../lib/RawModule");
|
|
|
|
const RequestShortener = require("../lib/RequestShortener");
|
|
|
|
|
|
|
|
describe("RawModule", () => {
|
2018-01-24 20:17:21 +08:00
|
|
|
const source = "sourceStr attribute";
|
|
|
|
const identifier = "identifierStr attribute";
|
|
|
|
const readableIdentifier = "readableIdentifierStr attribute";
|
|
|
|
const myRawModule = new RawModule(source, identifier, readableIdentifier);
|
2017-01-06 22:23:29 +08:00
|
|
|
|
2017-01-18 22:27:19 +08:00
|
|
|
describe("identifier", () => {
|
2018-01-24 20:17:21 +08:00
|
|
|
it("returns value for identifierStr attribute", () => {
|
|
|
|
expect(myRawModule.identifier()).toBe("identifierStr attribute");
|
|
|
|
});
|
2017-01-06 22:23:29 +08:00
|
|
|
});
|
|
|
|
|
2017-01-18 22:27:19 +08:00
|
|
|
describe("size", () => {
|
2018-02-25 18:46:17 +08:00
|
|
|
it('returns value for sourceStr attribute"s length property', () => {
|
2017-01-18 22:27:19 +08:00
|
|
|
const sourceStrLength = myRawModule.sourceStr.length;
|
2018-01-24 20:17:21 +08:00
|
|
|
expect(myRawModule.size()).toBe(sourceStrLength);
|
2017-01-06 22:23:29 +08:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2017-01-18 22:27:19 +08:00
|
|
|
describe("readableIdentifier", () => {
|
2018-02-25 18:46:17 +08:00
|
|
|
it(
|
|
|
|
'returns result of calling provided requestShortener"s shorten method ' +
|
|
|
|
"on readableIdentifierStr attribute",
|
2017-02-10 06:38:39 +08:00
|
|
|
() => {
|
|
|
|
const requestShortener = new RequestShortener(path.resolve());
|
2018-01-24 20:17:21 +08:00
|
|
|
expect(myRawModule.readableIdentifier(requestShortener)).toBeDefined();
|
2017-02-10 06:38:39 +08:00
|
|
|
}
|
|
|
|
);
|
2017-01-06 22:23:29 +08:00
|
|
|
});
|
|
|
|
});
|