@@ -2,47 +2,32 @@ import { test } from "uvu";
2
2
import * as assert from "uvu/assert" ;
3
3
4
4
import { Base } from "../index.js" ;
5
-
6
- const fooPlugin = ( test ) => {
7
- return {
8
- foo : ( ) => "foo" ,
9
- } ;
10
- } ;
11
- const barPlugin = ( test ) => {
12
- return {
13
- bar : ( ) => "bar" ,
14
- } ;
15
- } ;
16
- const pluginWithEmptyObjectReturn = ( test ) => {
17
- return { } ;
18
- } ;
5
+ import { fooPlugin } from "../plugins/foo/index.js" ;
6
+ import { barPlugin } from "../plugins/bar/index.js" ;
7
+ import { voidPlugin } from "../plugins/void/index.js" ;
19
8
20
9
test ( ".plugin(fooPlugin)" , ( ) => {
21
10
const FooTest = Base . plugin ( fooPlugin ) ;
22
11
const fooTest = new FooTest ( ) ;
23
- assert . equal ( fooTest . foo ( ) , "foo" ) ;
12
+ assert . equal ( fooTest . foo , "foo" ) ;
24
13
} ) ;
25
14
test ( ".plugin(fooPlugin, barPlugin)" , ( ) => {
26
15
const FooBarTest = Base . plugin ( fooPlugin , barPlugin ) ;
27
16
const fooBarTest = new FooBarTest ( ) ;
28
- assert . equal ( fooBarTest . foo ( ) , "foo" ) ;
29
- assert . equal ( fooBarTest . bar ( ) , "bar" ) ;
17
+ assert . equal ( fooBarTest . foo , "foo" ) ;
18
+ assert . equal ( fooBarTest . bar , "bar" ) ;
30
19
} ) ;
31
- test ( ".plugin(fooPlugin, barPlugin, pluginWithVoidReturn)" , ( ) => {
32
- const FooBarTest = Base . plugin (
33
- fooPlugin ,
34
- barPlugin ,
35
- pluginWithEmptyObjectReturn
36
- ) ;
20
+ test ( ".plugin(fooPlugin, barPlugin, voidPlugin)" , ( ) => {
21
+ const FooBarTest = Base . plugin ( fooPlugin , barPlugin , voidPlugin ) ;
37
22
const fooBarTest = new FooBarTest ( ) ;
38
- assert . equal ( fooBarTest . foo ( ) , "foo" ) ;
39
- assert . equal ( fooBarTest . bar ( ) , "bar" ) ;
23
+ assert . equal ( fooBarTest . foo , "foo" ) ;
24
+ assert . equal ( fooBarTest . bar , "bar" ) ;
40
25
} ) ;
41
26
test ( ".plugin(fooPlugin).plugin(barPlugin)" , ( ) => {
42
27
const FooBarTest = Base . plugin ( fooPlugin ) . plugin ( barPlugin ) ;
43
28
const fooBarTest = new FooBarTest ( ) ;
44
- assert . equal ( fooBarTest . foo ( ) , "foo" ) ;
45
- assert . equal ( fooBarTest . bar ( ) , "bar" ) ;
29
+ assert . equal ( fooBarTest . foo , "foo" ) ;
30
+ assert . equal ( fooBarTest . bar , "bar" ) ;
46
31
} ) ;
47
32
test ( ".defaults({foo: 'bar'})" , ( ) => {
48
33
const BaseWithDefaults = Base . defaults ( { foo : "bar" } ) ;
@@ -63,9 +48,9 @@ test(".plugin().defaults()", () => {
63
48
const instance1 = new BaseWithPluginAndDefaults ( ) ;
64
49
const instance2 = new BaseWithDefaultsAndPlugin ( ) ;
65
50
66
- assert . equal ( instance1 . foo ( ) , "foo" ) ;
51
+ assert . equal ( instance1 . foo , "foo" ) ;
67
52
assert . equal ( instance1 . options , { baz : "daz" } ) ;
68
- assert . equal ( instance2 . foo ( ) , "foo" ) ;
53
+ assert . equal ( instance2 . foo , "foo" ) ;
69
54
assert . equal ( instance2 . options , { baz : "daz" } ) ;
70
55
} ) ;
71
56
0 commit comments