11import { strictEqual , deepStrictEqual } from 'node:assert' ;
22import { describe , it } from 'node:test' ;
33
4+ import typeMap from '../../parser/typeMap.json' with { type : 'json' } ;
45import createQueries from '../index.mjs' ;
56
67describe ( 'createQueries' , ( ) => {
8+ const queries = createQueries ( typeMap ) ;
9+
710 it ( 'should add YAML metadata correctly' , ( ) => {
8- const queries = createQueries ( ) ;
911 const node = { value : 'type: test\nname: test\n' } ;
1012 const apiEntryMetadata = {
1113 updateProperties : properties => {
@@ -17,7 +19,6 @@ describe('createQueries', () => {
1719
1820 // valid type
1921 it ( 'should update type to reference correctly' , ( ) => {
20- const queries = createQueries ( ) ;
2122 const node = {
2223 value : 'This is a {string} type.' ,
2324 position : { start : 0 , end : 0 } ,
@@ -35,7 +36,6 @@ describe('createQueries', () => {
3536 } ) ;
3637
3738 it ( 'should update type to reference not correctly if no match' , ( ) => {
38- const queries = createQueries ( ) ;
3939 const node = {
4040 value : 'This is a {test} type.' ,
4141 position : { start : 0 , end : 0 } ,
@@ -47,7 +47,6 @@ describe('createQueries', () => {
4747 } ) ;
4848
4949 it ( 'should add heading metadata correctly' , ( ) => {
50- const queries = createQueries ( ) ;
5150 const node = {
5251 depth : 2 ,
5352 children : [ { type : 'text' , value : 'Test Heading' } ] ,
@@ -74,14 +73,12 @@ describe('createQueries', () => {
7473 } ) ;
7574
7675 it ( 'should update markdown link correctly' , ( ) => {
77- const queries = createQueries ( ) ;
7876 const node = { type : 'link' , url : 'test.md#heading' } ;
7977 queries . updateMarkdownLink ( node ) ;
8078 strictEqual ( node . url , 'test.html#heading' ) ;
8179 } ) ;
8280
8381 it ( 'should update link reference correctly' , ( ) => {
84- const queries = createQueries ( ) ;
8582 const node = { type : 'linkReference' , identifier : 'test' } ;
8683 const definitions = [ { identifier : 'test' , url : 'test.html#test' } ] ;
8784 queries . updateLinkReference ( node , definitions ) ;
@@ -90,7 +87,6 @@ describe('createQueries', () => {
9087 } ) ;
9188
9289 it ( 'should add stability index metadata correctly' , ( ) => {
93- const queries = createQueries ( ) ;
9490 const node = {
9591 type : 'blockquote' ,
9692 children : [
0 commit comments