Skip to content
Permalink
Browse files

- action or added

:goose:
  • Loading branch information...
maZahaca committed Dec 5, 2018
1 parent 24e8dec commit 1b0f9a0e6106046e74e27a32991e2633f1755b94
Showing with 132 additions and 0 deletions.
  1. +132 −0 test/integration/actions/actions.test.js
@@ -824,6 +824,138 @@ describe('Actions', () => {
});
});

describe('ActionOr', () => {
test('perform', async () => {
setServerResponse({
html: `<a href="#">test</a>`
});
const parser = new Parser({
environment: new ChromeEnvironment({ url }),
});
const result = await parser.parse({
rules: {
actions: [
{
type: 'condition',
if: [
{
type: 'or',
actions: [
{
type: 'exists',
scope: 'span',
},
{
type: 'exists',
scope: 'a',
}
]
}
],
then: [
{
type: 'provideRules',
rules: {
scope: 'a',
},
}
],
},
],
rulesFromActions: true,
},
});

expect(result).toEqual('test');
});

test('perform', async () => {
setServerResponse({
html: `<a href="#">test</a>`
});
const parser = new Parser({
environment: new ChromeEnvironment({ url }),
});
const result = await parser.parse({
rules: {
actions: [
{
type: 'condition',
if: [
{
type: 'or',
actions: [
{
type: 'exists',
scope: 'a',
},
{
type: 'exists',
scope: 'span',
},
]
}
],
then: [
{
type: 'provideRules',
rules: {
scope: 'a',
},
}
],
},
],
rulesFromActions: true,
},
});

expect(result).toEqual('test');
});

test('perform without or values', async () => {
setServerResponse({
html: `<a href="#">test</a>`
});
const parser = new Parser({
environment: new ChromeEnvironment({ url }),
});
const result = await parser.parse({
rules: {
actions: [
{
type: 'condition',
if: [
{
type: 'or',
}
],
then: [
{
type: 'provideRules',
rules: {
scope: 'span',
},
}
],
else: [
{
type: 'provideRules',
rules: {
scope: 'a',
},
}
],
},
],
rulesFromActions: true,
},
});

expect(result).toEqual('test');
});
});

describe('ActionHasRedirect', () => {
test('perform', async () => {
setServerResponse([

0 comments on commit 1b0f9a0

Please sign in to comment.
You can’t perform that action at this time.