Commit 1813576d authored by devjiwonchoi's avatar devjiwonchoi

test: update import-json for assertion

parent eab3f4d5
......@@ -3,6 +3,9 @@ export default function Page() {
<p>
{JSON.stringify([
process.env.jsonObjDefault,
process.env.jsonObjDefault123,
process.env.jsonObjDefaultWithSpace,
process.env.jsonObjDefaultWithHyphen,
process.env.jsonObjNamed,
process.env.jsonArray,
])}
......
export default function Page() {
return <p>{process.env.foo}</p>
return (
<p>
{JSON.stringify([
process.env.jsonObjDefault,
process.env.jsonObjDefault123,
process.env.jsonObjDefaultWithSpace,
process.env.jsonObjDefaultWithHyphen,
process.env.jsonArray,
])}
</p>
)
}
......@@ -11,14 +11,7 @@ describe('next-config-ts-import-json-esm', () => {
it('should support import json (ESM)', async () => {
const $ = await next.render$('/')
expect($('p').text()).toBe(
JSON.stringify([
'object',
'123',
'with space',
'with-hyphen',
'object',
'array',
])
JSON.stringify(['object', '123', 'with space', 'with-hyphen', 'array'])
)
})
})
import type { NextConfig } from 'next'
import fooJson from './foo.json' with { type: 'json' }
import jsonObjDefault from './object.json' with { type: 'json' }
import jsonArray from './array.json' with { type: 'json' }
// ESM doesn't support named imports from JSON files.
export default {
env: {
foo: fooJson.foo,
jsonObjDefault: jsonObjDefault.object,
jsonObjDefault123: String(jsonObjDefault['123number']),
jsonObjDefaultWithSpace: jsonObjDefault['with space'],
jsonObjDefaultWithHyphen: jsonObjDefault['with-hyphen'],
jsonArray: jsonArray[0].array,
},
} satisfies NextConfig
{
"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