@tehw0lf/yaft 0.0.3 → 0.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/build.yml +1 -0
- package/CLAUDE.md +138 -0
- package/jest.config.js +13 -0
- package/logo.svg +1 -1
- package/package.json +7 -2
- package/src/test/decorator-behavior.spec.ts +359 -0
- package/src/test/error-handling.spec.ts +391 -0
- package/src/test/feature-data.spec.ts +102 -0
- package/src/test/integration.spec.ts +472 -0
- package/src/test/providers.spec.ts +218 -0
- package/src/test/test-boolean.json +1 -0
- package/src/test/test-feature.json +20 -0
- package/src/test/test-setup.ts +2 -0
- package/src/test/yaft.demo.spec.ts +53 -0
- package/tsconfig.json +1 -1
- package/tsconfig.spec.json +10 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"myClassToggle": {
|
|
3
|
+
"key": "myClassToggle",
|
|
4
|
+
"value": "false",
|
|
5
|
+
"activeAt": "",
|
|
6
|
+
"disabledAt": ""
|
|
7
|
+
},
|
|
8
|
+
"myMethodToggle": {
|
|
9
|
+
"key": "myMethodToggle",
|
|
10
|
+
"value": "true",
|
|
11
|
+
"activeAt": "",
|
|
12
|
+
"disabledAt": ""
|
|
13
|
+
},
|
|
14
|
+
"myOtherMethodToggle": {
|
|
15
|
+
"key": "myOtherMethodToggle",
|
|
16
|
+
"value": "false",
|
|
17
|
+
"activeAt": "",
|
|
18
|
+
"disabledAt": ""
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { FeatureToggle, FeatureToggleBase } from "..";
|
|
2
|
+
import { LocalStorageFeatureProvider } from "../examples/LocalStorageFeatureProvider";
|
|
3
|
+
|
|
4
|
+
FeatureToggleBase.featureProvider = new LocalStorageFeatureProvider(
|
|
5
|
+
"../test/test-feature.json"
|
|
6
|
+
);
|
|
7
|
+
|
|
8
|
+
class Demo3 {
|
|
9
|
+
constructor() {}
|
|
10
|
+
|
|
11
|
+
async five() {
|
|
12
|
+
return Promise.resolve(9);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
@FeatureToggle("myClassToggle", Demo3)
|
|
17
|
+
class Demo2 {
|
|
18
|
+
constructor() {}
|
|
19
|
+
|
|
20
|
+
async five() {
|
|
21
|
+
return Promise.resolve(5);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function myFallback() {
|
|
26
|
+
console.log("hiyaa");
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export class Demo {
|
|
30
|
+
demo: Demo2;
|
|
31
|
+
constructor() {
|
|
32
|
+
this.demo = new Demo2();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@FeatureToggle("myMethodToggle")
|
|
36
|
+
method() {
|
|
37
|
+
console.log("Hello world!");
|
|
38
|
+
this.demo.five().then((val) => console.log(val));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
@FeatureToggle("myOtherMethodToggle", myFallback)
|
|
42
|
+
othermethod() {
|
|
43
|
+
console.log("Hello other world!");
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
describe("YaFT Demo", () => {
|
|
48
|
+
it("should create test", () => {
|
|
49
|
+
const test = new Demo();
|
|
50
|
+
test.method();
|
|
51
|
+
test.othermethod();
|
|
52
|
+
});
|
|
53
|
+
});
|
package/tsconfig.json
CHANGED