Commit ee164dae authored by devjiwonchoi's avatar devjiwonchoi

test: improve import json edge case

parent 2a73ab0f
...@@ -7,6 +7,15 @@ describe('next-config-ts-import-json-cjs', () => { ...@@ -7,6 +7,15 @@ describe('next-config-ts-import-json-cjs', () => {
it('should support import json (CJS)', async () => { it('should support import json (CJS)', async () => {
const $ = await next.render$('/') const $ = await next.render$('/')
expect($('p').text()).toBe(JSON.stringify(['object', 'object', 'array'])) expect($('p').text()).toBe(
JSON.stringify([
'object',
'123',
'with space',
'with-hyphen',
'object',
'array',
])
)
}) })
}) })
...@@ -10,6 +10,15 @@ describe('next-config-ts-import-json-esm', () => { ...@@ -10,6 +10,15 @@ describe('next-config-ts-import-json-esm', () => {
it('should support import json (ESM)', async () => { it('should support import json (ESM)', async () => {
const $ = await next.render$('/') const $ = await next.render$('/')
expect($('p').text()).toBe(JSON.stringify(['object', 'object', 'array'])) expect($('p').text()).toBe(
JSON.stringify([
'object',
'123',
'with space',
'with-hyphen',
'object',
'array',
])
)
}) })
}) })
...@@ -6,6 +6,9 @@ import jsonArray from './array.json' ...@@ -6,6 +6,9 @@ import jsonArray from './array.json'
export default { export default {
env: { env: {
jsonObjDefault: jsonObjDefault.object, jsonObjDefault: jsonObjDefault.object,
jsonObjDefault123: String(jsonObjDefault['123number']),
jsonObjDefaultWithSpace: jsonObjDefault['with space'],
jsonObjDefaultWithHyphen: jsonObjDefault['with-hyphen'],
jsonObjNamed, jsonObjNamed,
jsonArray: jsonArray[0].array, jsonArray: jsonArray[0].array,
}, },
......
{ {
"object": "object" "object": "object",
"123number": 123,
"with space": "with space",
"with-hyphen": "with-hyphen"
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment