Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit b3626fc

Browse files
committed
Created reset function tests and fixed small typo
1 parent 348e9db commit b3626fc

File tree

2 files changed

+37
-1
lines changed

2 files changed

+37
-1
lines changed

test/event/functions/enable.function.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ describe('Enable Function Tests', () => {
2121
});
2222

2323
it('Can enable Event', () => {
24-
// Disable Event
24+
// Enable Event
2525
MY_EVENT.enable();
2626

2727
expect(MY_EVENT.uses).to.eq(0, 'MY_EVENT uses stayed the same');
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import 'mocha';
2+
import {expect} from 'chai';
3+
import Agile from "../../../src";
4+
5+
describe('Reset Function Tests', () => {
6+
// Define Agile
7+
const App = new Agile();
8+
9+
interface EventPayload {
10+
title: string
11+
message: string
12+
}
13+
14+
// Create Event
15+
const MY_EVENT = App.Event<EventPayload>();
16+
17+
// Trigger and disable Event
18+
MY_EVENT.trigger();
19+
MY_EVENT.trigger();
20+
MY_EVENT.disable();
21+
22+
it('Has correct initial value', () => {
23+
expect(MY_EVENT.uses).to.eq(2, 'MY_EVENT uses has correct initial value');
24+
expect(JSON.stringify(MY_EVENT.config)).to.eq(JSON.stringify({enabled: true}), 'MY_EVENT has correct initial config');
25+
expect(MY_EVENT.enabled).to.eq(false, 'MY_EVENT is disabled');
26+
});
27+
28+
it('Can reset Event', () => {
29+
// Reset Event
30+
MY_EVENT.reset();
31+
32+
expect(MY_EVENT.uses).to.eq(0, 'MY_EVENT uses has been reset');
33+
expect(JSON.stringify(MY_EVENT.config)).to.eq(JSON.stringify({enabled: true}), 'MY_EVENT has correct config');
34+
expect(MY_EVENT.enabled).to.eq(true, 'MY_EVENT is enabled');
35+
});
36+
});

0 commit comments

Comments
 (0)