Skip to content

Commit

Permalink
Adjust tests to new reactions
Browse files Browse the repository at this point in the history
  • Loading branch information
fracz committed Nov 29, 2024
1 parent e0bb0b4 commit 8431886
Showing 1 changed file with 15 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,11 @@ describe('ChannelReactionsConfig', () => {
});

describe('THERMOMETER', () => {
const channel = {functionId: ChannelFunction.THERMOMETER, config: {}};

it('displays unit', async () => {
const wrapper = await mount({
data: () => ({channel: {functionId: ChannelFunction.THERMOMETER}, condition: undefined}),
data: () => ({channel, condition: undefined}),
template: '<div><cc :subject="channel" v-model="condition"/></div>',
components: {cc: ChannelReactionConditionChooser},
});
Expand All @@ -88,7 +90,7 @@ describe('ChannelReactionsConfig', () => {

it('can set the temperature condition parameters', async () => {
const wrapper = await mount({
data: () => ({channel: {functionId: ChannelFunction.THERMOMETER}, condition: undefined}),
data: () => ({channel, condition: undefined}),
template: '<div><cc :subject="channel" v-model="condition"/></div>',
components: {cc: ChannelReactionConditionChooser},
});
Expand All @@ -109,7 +111,7 @@ describe('ChannelReactionsConfig', () => {

it('can set negative threshold', async () => {
const wrapper = await mount({
data: () => ({channel: {functionId: ChannelFunction.THERMOMETER}, condition: undefined}),
data: () => ({channel, condition: undefined}),
template: '<div><cc :subject="channel" v-model="condition"/></div>',
components: {cc: ChannelReactionConditionChooser},
});
Expand All @@ -124,7 +126,7 @@ describe('ChannelReactionsConfig', () => {

it('can set negative resume threshold', async () => {
const wrapper = await mount({
data: () => ({channel: {functionId: ChannelFunction.THERMOMETER}, condition: undefined}),
data: () => ({channel, condition: undefined}),
template: '<div><cc :subject="channel" v-model="condition"/></div>',
components: {cc: ChannelReactionConditionChooser},
});
Expand All @@ -141,7 +143,7 @@ describe('ChannelReactionsConfig', () => {

it('cannot set empty threshold for temerature', async () => {
const wrapper = await mount({
data: () => ({channel: {functionId: ChannelFunction.THERMOMETER}, condition: undefined}),
data: () => ({channel, condition: undefined}),
template: '<div><cc :subject="channel" v-model="condition"/></div>',
components: {cc: ChannelReactionConditionChooser},
});
Expand All @@ -153,7 +155,7 @@ describe('ChannelReactionsConfig', () => {
it('can initialize temperature condition with initial value', async () => {
const wrapper = await mount({
data: () => ({
channel: {functionId: ChannelFunction.THERMOMETER},
channel,
condition: {on_change_to: {gt: 33, name: 'temperature'}}
}),
template: '<div><cc :subject="channel" v-model="condition"/></div>',
Expand All @@ -166,7 +168,7 @@ describe('ChannelReactionsConfig', () => {
it('can initialize temperature condition with initial value with threshold 0', async () => {
const wrapper = await mount({
data: () => ({
channel: {functionId: ChannelFunction.THERMOMETER},
channel,
condition: {on_change_to: {gt: 0, name: 'temperature'}}
}),
template: '<div><cc :subject="channel" v-model="condition"/></div>',
Expand All @@ -179,7 +181,7 @@ describe('ChannelReactionsConfig', () => {
it('can initialize temperature condition on_change', async () => {
const wrapper = await mount({
data: () => ({
channel: {functionId: ChannelFunction.THERMOMETER},
channel,
condition: {on_change: {name: 'temperature'}}
}),
template: '<div><cc :subject="channel" v-model="condition"/></div>',
Expand All @@ -190,7 +192,7 @@ describe('ChannelReactionsConfig', () => {

it('can set invalid threshold for a while', async () => {
const wrapper = await mount({
data: () => ({channel: {functionId: ChannelFunction.THERMOMETER}, condition: undefined}),
data: () => ({channel, condition: undefined}),
template: '<div><cc :subject="channel" v-model="condition"/></div>',
components: {cc: ChannelReactionConditionChooser},
});
Expand All @@ -203,9 +205,11 @@ describe('ChannelReactionsConfig', () => {
});

describe('HUMIDITYANDTEMPERATURE', () => {
const channel = {functionId: ChannelFunction.HUMIDITYANDTEMPERATURE, config: {}};

it('can set humidity threshold', async () => {
const wrapper = await mount({
data: () => ({channel: {functionId: ChannelFunction.HUMIDITYANDTEMPERATURE}, condition: undefined}),
data: () => ({channel, condition: undefined}),
template: '<div><cc :subject="channel" v-model="condition"/></div>',
components: {cc: ChannelReactionConditionChooser},
});
Expand All @@ -218,7 +222,7 @@ describe('ChannelReactionsConfig', () => {
it('initializes humidity condition from json', async () => {
const wrapper = await mount({
data: () => ({
channel: {functionId: ChannelFunction.HUMIDITYANDTEMPERATURE},
channel,
condition: {on_change_to: {lt: 60, name: 'humidity'}}
}),
template: '<div><cc :subject="channel" v-model="condition"/></div>',
Expand Down

0 comments on commit 8431886

Please sign in to comment.