-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
107 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
const redisVersion = '6.2.3' | ||
|
||
// schotter, plotter on paper, by Georg Nees | ||
function version5() { | ||
// Using lolwut version 5 20 10 | ||
return `⢰⠒⢲⠒⢲⠒⣶⠒⡖⢲⡖⢲⠒⣶⠒⡖⠒⡖⠒⡆ | ||
⢸⠒⢺⠒⢺⠒⣿⠒⡗⢺⡗⢺⠒⣿⠒⡗⠒⡗⠒⡇ | ||
⡞⠒⣾⣛⣻⣛⣿⢻⡟⢻⠛⣿⢻⡟⢻⠓⢲⣗⣒⡇ | ||
⣻⠿⣿⣉⣯⣹⣏⣹⣯⣹⣏⣹⣉⣿⢹⣟⣻⣓⣺⠃ | ||
⣌⣉⣿⠭⣧⣸⣏⣹⣯⣯⣯⣯⣽⣯⣿⣉⣹⣄⣸⠀ | ||
⣯⣁⣿⣭⣽⣼⣼⡼⣿⣬⣇⣹⡮⣿⣻⣗⣽⣒⡼⡅ | ||
⢗⣉⢿⣦⣿⣿⣧⢷⣷⣯⣧⣟⣷⣾⣼⣗⣿⢗⣹⢇ | ||
⢳⠞⢺⠶⣿⠾⣟⣻⣾⠟⢷⣟⢾⢷⣿⣓⢧⡧⠴⡎ | ||
⡼⠶⡞⢒⡾⠾⡝⢲⡷⡽⢾⣿⢼⣾⢿⠒⣾⡿⠶⡧ | ||
⢷⠶⣷⣺⢷⣹⢟⣲⢫⠷⡯⢿⢽⢿⢾⡟⢺⢳⢲⠁ | ||
⡸⠺⡺⣺⡻⢾⠞⢛⢶⡻⢞⠾⣹⢿⣾⠙⣻⠛⠺⡀ | ||
⠈⠢⠊⠚⠒⠚⠑⠔⠑⠜⠣⠛⠼⠥⠼⠉⠋⠢⠊⠀ | ||
Georg Nees - schotter, plotter on paper, 1968. Redis ver. ${redisVersion}` | ||
} | ||
|
||
// Plaguemon by hikimori | ||
function version6() { | ||
// Using lolwut version 6 20 10 | ||
return `[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m | ||
[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m | ||
[0;97;107m [0m[0;97;107m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m[0;97;107m [0m | ||
[0;97;107m [0m[0;97;107m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;97;107m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m | ||
[0;97;107m [0m[0;97;107m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m | ||
[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;37;47m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m | ||
[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;37;47m [0m[0;37;47m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;30;40m [0m[0;30;40m [0m | ||
[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;37;47m [0m[0;37;47m [0m[0;30;40m [0m[0;30;40m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;37;47m [0m[0;37;47m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;30;40m [0m[0;30;40m [0m | ||
[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;37;47m [0m[0;37;47m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;30;40m [0m[0;30;40m [0m | ||
[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;30;40m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;37;47m [0m[0;37;47m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;90;100m [0m[0;30;40m [0m[0;30;40m [0m | ||
Dedicated to the 8 bit game developers of past and present. | ||
Original 8 bit image from Plaguemon by hikikomori. Redis ver. ${redisVersion}` | ||
} | ||
|
||
export function lolwut(VERSION = 'VERSION', version) { | ||
if (VERSION && VERSION.toUpperCase() !== 'VERSION') { | ||
throw new Error('ERR value is not an integer or out of range') | ||
} | ||
|
||
// eslint-disable-next-line eqeqeq | ||
if (version == 6) { | ||
return version6() | ||
} | ||
|
||
// eslint-disable-next-line eqeqeq | ||
if (version == 5) { | ||
return version5() | ||
} | ||
|
||
return version6() | ||
} | ||
|
||
export function lolwutBuffer(...args) { | ||
const val = lolwut.apply(this, args) | ||
return val ? Buffer.from(val) : val | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import Redis from 'ioredis' | ||
|
||
// eslint-disable-next-line import/no-relative-parent-imports | ||
import { runTwinSuite } from '../../../test-utils' | ||
|
||
runTwinSuite('lolwut', command => { | ||
describe(command, () => { | ||
const redis = new Redis() | ||
|
||
afterAll(() => { | ||
redis.disconnect() | ||
}) | ||
|
||
test('should throw on invalid arguments', async () => { | ||
expect.hasAssertions() | ||
|
||
try { | ||
await redis[command]('ver', 5) | ||
} catch (err) { | ||
expect(err.message).toMatch('ERR') | ||
} | ||
}) | ||
|
||
test('should return Plaguemon by hikikomori. by default', async () => { | ||
const result = await redis[command]() | ||
expect(Buffer.isBuffer(result) ? result.toString() : result).toMatch( | ||
'hikikomori' | ||
) | ||
}) | ||
|
||
test('version 6', async () => { | ||
const result = await redis[command]('version', 6, 20, 10) | ||
expect(Buffer.isBuffer(result) ? result.toString() : result).toMatch( | ||
'hikikomori' | ||
) | ||
}) | ||
|
||
test('version 5', async () => { | ||
const result = await redis[command]('version', 5, 20, 10) | ||
expect(Buffer.isBuffer(result) ? result.toString() : result).toMatch( | ||
'schotter' | ||
) | ||
}) | ||
}) | ||
}) |