Skip to content

Commit

Permalink
Add a couple more tests (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
XhmikosR authored Apr 15, 2024
1 parent 831b35d commit 289b6f6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ const assert = require('assert').strict;
const detective = require('../index.js');

describe('detective-vue2', () => {
it('throws if the source content is not given', () => {
assert.throws(() => {
detective();
}, /^Error: content not given$/);
});

it('throws if the source content is not given', () => {
assert.throws(() => {
detective(() => {});
}, /^Error: content is not a string$/);
});

it('retrieves the dependencies of script block lang ts', () => {
const deps = detective('<template></template> <script lang="ts">import {foo, bar} from "mylib"; </script>');
assert.equal(deps.length, 1);
Expand Down

0 comments on commit 289b6f6

Please sign in to comment.