@sketch-hq/sketch-naming-conventions-assistant
Version:
- [Page names](https://github.com/sketch-hq/sketch-assistants/tree/main/assistants/core/src/rules/name-pattern-pages) should start with an emoji, e.g. `🚧 Work in Progress`. - [Artboard names](https://github.com/sketch-hq/sketch-assistants/tree/main/ass
69 lines (68 loc) • 4.11 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const path_1 = require("path");
const sketch_assistant_utils_1 = require("@sketch-hq/sketch-assistant-utils");
const __1 = __importDefault(require(".."));
const testCoreRule = (fixture, ruleName) => __awaiter(void 0, void 0, void 0, function* () {
return yield sketch_assistant_utils_1.testRuleInAssistant(path_1.resolve(__dirname, fixture), __1.default, `@sketch-hq/sketch-core-assistant/${ruleName}`);
});
describe('name-pattern-pages', () => {
test('no violation for emojis at start', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./valid-page-names.sketch', 'name-pattern-pages');
expect(violations).toHaveLength(0);
expect(ruleErrors).toHaveLength(0);
}));
test('violations for no emojis at start', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./invalid-page-names.sketch', 'name-pattern-pages');
expect(violations).toHaveLength(4);
expect(ruleErrors).toHaveLength(0);
}));
});
describe('name-pattern-artboards', () => {
test('no violations for properly numbered artboards', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./valid-artboard-names.sketch', 'name-pattern-artboards');
expect(violations).toHaveLength(0);
expect(ruleErrors).toHaveLength(0);
}));
test('violations for artboards that haven not been numbered', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./invalid-artboard-names.sketch', 'name-pattern-artboards');
expect(violations).toHaveLength(3);
expect(ruleErrors).toHaveLength(0);
}));
});
describe('name-pattern-groups', () => {
test('no violations for properly named groups', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./valid-group-names.sketch', 'name-pattern-groups');
expect(violations).toHaveLength(0);
expect(ruleErrors).toHaveLength(0);
}));
test('violations for groups that haven not been properly named', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./invalid-group-names.sketch', 'name-pattern-groups');
expect(violations).toHaveLength(2);
expect(ruleErrors).toHaveLength(0);
}));
});
describe('name-pattern-symbols', () => {
test('no violations for symbol names using grouping', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./valid-symbol-names.sketch', 'name-pattern-symbols');
expect(violations).toHaveLength(0);
expect(ruleErrors).toHaveLength(0);
}));
test('violations for symbol names not using grouping', () => __awaiter(void 0, void 0, void 0, function* () {
const { violations, ruleErrors } = yield testCoreRule('./invalid-symbol-names.sketch', 'name-pattern-symbols');
expect(violations).toHaveLength(3);
expect(ruleErrors).toHaveLength(0);
}));
});