Nutmeg Pumpkin Macchiato

    @qavajs/memory
    TypeScript icon, indicating that this package has built-in type declarations

    1.1.0 • Public • Published

    @qavajs/memory

    This library provides the capability to transit variables between step and access them from gherkin definitions

    npm install @qavajs/memory

    Usage

    Lib resolves provided value from storage

    const memory = require('@qavajs/memory');
    
    When(/^save variable as '(.+)'$/, async function (key) {
        memory.setValue(key, 42);
    });
    
    Then(/^value '(.+)' should be equal to '(.+)'$/, async function (variable1, variable2) {
        const val = memory.getValue(variable1);
        expect(val).to.equal(variable2);
    });
    When save variable as 'variable'
    Then value of '$variable' should be equal to '42'

    Using constants and computed

    Lib provides capability to set constant values and computed (values that calculated in the moment of call)

    module.exports = {
        CONSTANT: 42,
        computed: function() {
            return Date.now()
        }
    };

    Register constants and computed

    Before using memory it needs to be registered. The best place to do it is Before hook

    const memory = require('@qavajs/memory');
    const memoryMap = require('./memoryMap.js')
    Before(async function() {
        memory.register(memoryMap);
    });

    Keywords

    none

    Install

    npm i @qavajs/memory

    DownloadsWeekly Downloads

    9

    Version

    1.1.0

    License

    MIT

    Unpacked Size

    6.85 kB

    Total Files

    7

    Last publish

    Collaborators

    • kirill_bogdanets
    • alexgalichenko