Skip to content

Commit

Permalink
Add tests for Vue
Browse files Browse the repository at this point in the history
  • Loading branch information
vikingair committed May 23, 2024
1 parent 5c9b1c3 commit 01b85cd
Show file tree
Hide file tree
Showing 8 changed files with 2,054 additions and 5,890 deletions.
7,896 changes: 2,008 additions & 5,888 deletions package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion test/typescript/custom-paths/subfolder2/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ class ExportClass {
}
}

export = ExportClass;
export default ExportClass;
2 changes: 1 addition & 1 deletion test/typescript/export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ class ExportClass {
}
}

export = ExportClass;
export default ExportClass;
21 changes: 21 additions & 0 deletions test/vue.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/* eslint-env mocha */
'use strict';

const madge = require('../lib/api');
require('should');

describe('Vue', () => {
const dir = __dirname + '/vue';

it('finds import in Vue files', (done) => {
madge(dir + '/BasicComponent.vue').then((res) => {
res.obj().should.eql({
'BasicComponent.vue': ['OneNested.vue', 'TwoNested.vue'],
'OneNested.vue': ['ThreeNested.vue'], // TODO: Should also include 'vue', './NotExistingNested.vue', '../typescript/export'
'ThreeNested.vue': [],
'TwoNested.vue': []
});
done();
}).catch(done);
});
});
9 changes: 9 additions & 0 deletions test/vue/BasicComponent.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<script lang="ts" setup>
import OneNested from './OneNested.vue';
import TwoNested from './TwoNested.vue';
</script>

<template>
<OneNested />
<TwoNested />
</template>
12 changes: 12 additions & 0 deletions test/vue/OneNested.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<script lang="ts" setup>
import { ref } from "vue";
import ThreeNested from "./ThreeNested.vue";
import NotExistingNested from "./NotExistingNested.vue";
import ExportClass from "../typescript/export";
const count = ref(0);
</script>

<template>
<button @click="count++">{{ count }}</button>
</template>
1 change: 1 addition & 0 deletions test/vue/ThreeNested.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<template>Content without deps</template>
1 change: 1 addition & 0 deletions test/vue/TwoNested.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<template>Content without deps</template>

0 comments on commit 01b85cd

Please sign in to comment.