Created
May 26, 2021 14:20
-
-
Save sergueyarellano/c174d8e798dc3ffe1376fd7647e6e912 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defineStep('every element on {string} property has {string}', async function (property, option, table) { | |
const propFromResponse = get(this.response, property, {}) | |
if (option === 'interface') { | |
const model = table.rowsHash() // to format a table of 2 columns | |
const actual = isValidInterface(propFromResponse, model) | |
const expected = true | |
deepStrictEqual(actual, expected) | |
} else if (option === 'restrictions') { | |
// table hashes: [ { property: 'distance', operator: 'less than', value: '200' } ] | |
// table rows: [ [ 'distance', 'less than', '200' ] ] | |
const restrictions = table.hashes() | |
const actual = complyWith(propFromResponse, restrictions) | |
const expected = true | |
deepStrictEqual(actual, expected) | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment