mirror of
https://github.com/vercel/next.js.git
synced 2026-09-20 02:25:18 +08:00
c7d6ab7f4c
We regressed in https://github.com/vercel/next.js/pull/73483 since the LRU calculates the value based on the value, not the key (and we were not setting the value).
28 lines
801 B
TypeScript
28 lines
801 B
TypeScript
import { warnOnce } from 'next/dist/build/output/log'
|
|
|
|
describe('build/output/log', () => {
|
|
it('warnOnce', () => {
|
|
const original = console.warn
|
|
try {
|
|
const messages = []
|
|
console.warn = (m: any) => messages.push(m)
|
|
warnOnce('test')
|
|
expect(messages.length).toEqual(1)
|
|
warnOnce('test again')
|
|
expect(messages.length).toEqual(2)
|
|
warnOnce('test', 'more')
|
|
expect(messages.length).toEqual(3)
|
|
warnOnce('test')
|
|
expect(messages.length).toEqual(3)
|
|
warnOnce('test again')
|
|
expect(messages.length).toEqual(3)
|
|
warnOnce('test', 'more')
|
|
expect(messages.length).toEqual(3)
|
|
warnOnce('test', 'should', 'add', 'another')
|
|
expect(messages.length).toEqual(4)
|
|
} finally {
|
|
console.warn = original
|
|
}
|
|
})
|
|
})
|