"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const step_name_extractor_1 = require("./step-name-extractor");
const assert_1 = require("assert");
const result = (part) => Object.assign({ index: 1, startTimestamp: Date.now() }, part);
describe('Figuring out a step\'s name', () => {
    it('Uses the selector and action name', () => {
        assert_1.strictEqual(step_name_extractor_1.extractStepName(result({ fnName: 'click', selector: '.myClass' })), 'click ".myClass"');
        assert_1.strictEqual(step_name_extractor_1.extractStepName(result({ fnName: 'dblclick', selector: '.myClass' })), 'dblclick ".myClass"');
        assert_1.strictEqual(step_name_extractor_1.extractStepName(result({ fnName: 'dblclick', selector: '#myId' })), 'dblclick "#myId"');
        assert_1.strictEqual(step_name_extractor_1.extractStepName(result({ fnName: 'select', selector: '#myId' })), 'select "#myId"');
        assert_1.strictEqual(step_name_extractor_1.extractStepName(result({ fnName: 'tap', selector: '#myId' })), 'tap "#myId"');
        assert_1.strictEqual(step_name_extractor_1.extractStepName(result({ fnName: 'waitForSelector', selector: '#myId' })), 'waitForSelector "#myId"');
    });
    it('Uses the step text when there is step text', () => {
        assert_1.strictEqual(step_name_extractor_1.extractStepName(result({ fnName: 'goto', text: 'http://www.example.com' })), 'goto "http://www.example.com"');
        assert_1.strictEqual(step_name_extractor_1.extractStepName(result({ fnName: 'type', text: 'loacker', selector: '#ilan' })), 'type "loacker" on "#ilan"');
    });
    it('Deals gracefully with missing data in case the user messes with things', () => {
        assert_1.strictEqual(step_name_extractor_1.extractStepName(result({})), 'Run Command');
    });
});
