Explorar o código

test: test app asset retrieval

Evan You %!s(int64=6) %!d(string=hai) anos
pai
achega
406dcb0a7a
Modificáronse 1 ficheiros con 10 adicións e 4 borrados
  1. 10 4
      packages/runtime-core/__tests__/apiApp.spec.ts

+ 10 - 4
packages/runtime-core/__tests__/apiApp.spec.ts

@@ -73,7 +73,11 @@ describe('api: createApp', () => {
 
   test('component', () => {
     const app = createApp()
-    app.component('FooBar', () => 'foobar!')
+
+    const FooBar = () => 'foobar!'
+    app.component('FooBar', FooBar)
+    expect(app.component('FooBar')).toBe(FooBar)
+
     app.component('BarBaz', () => 'barbaz!')
 
     const Root = {
@@ -103,9 +107,11 @@ describe('api: createApp', () => {
     const spy1 = jest.fn()
     const spy2 = jest.fn()
     const spy3 = jest.fn()
-    app.directive('FooBar', {
-      mounted: spy1
-    })
+
+    const FooBar = { mounted: spy1 }
+    app.directive('FooBar', FooBar)
+    expect(app.directive('FooBar')).toBe(FooBar)
+
     app.directive('BarBaz', {
       mounted: spy2
     })