@pgpm/base32 0.15.3 → 0.15.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Makefile CHANGED
@@ -1,5 +1,5 @@
1
1
  EXTENSION = pgpm-base32
2
- DATA = sql/pgpm-base32--0.15.2.sql
2
+ DATA = sql/pgpm-base32--0.15.3.sql
3
3
 
4
4
  PG_CONFIG = pg_config
5
5
  PGXS := $(shell $(PG_CONFIG) --pgxs)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pgpm/base32",
3
- "version": "0.15.3",
3
+ "version": "0.15.4",
4
4
  "description": "Base32 encoding and decoding functions for PostgreSQL",
5
5
  "author": "Dan Lynch <pyramation@gmail.com>",
6
6
  "contributors": [
@@ -21,10 +21,10 @@
21
21
  "test:watch": "jest --watch"
22
22
  },
23
23
  "dependencies": {
24
- "@pgpm/verify": "0.15.3"
24
+ "@pgpm/verify": "0.15.4"
25
25
  },
26
26
  "devDependencies": {
27
- "pgpm": "^1.0.0"
27
+ "pgpm": "^1.2.2"
28
28
  },
29
29
  "repository": {
30
30
  "type": "git",
@@ -34,5 +34,5 @@
34
34
  "bugs": {
35
35
  "url": "https://github.com/constructive-io/pgpm-modules/issues"
36
36
  },
37
- "gitHead": "187ed37f6b731132fe930acf5b5996b1e63ecca0"
37
+ "gitHead": "aad0dbef0336d6c18d027120ef9addc418822edd"
38
38
  }
@@ -1,6 +1,6 @@
1
1
  # pgpm-base32 extension
2
2
  comment = 'pgpm-base32 extension'
3
- default_version = '0.15.2'
3
+ default_version = '0.15.3'
4
4
  module_pathname = '$libdir/pgpm-base32'
5
5
  requires = 'pgcrypto,plpgsql,pgpm-verify'
6
6
  relocatable = false
@@ -1,21 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`base32.decode cases INQXI 1`] = `"Cat"`;
4
-
5
- exports[`base32.decode cases MNUGK3LJON2HE6LJONTXEZLBOQ====== 1`] = `"chemistryisgreat"`;
6
-
7
- exports[`base32.decode cases MY====== 1`] = `"f"`;
8
-
9
- exports[`base32.decode cases MZXQ==== 1`] = `"fo"`;
10
-
11
- exports[`base32.decode cases MZXW6=== 1`] = `"foo"`;
12
-
13
- exports[`base32.decode cases MZXW6YQ= 1`] = `"foob"`;
14
-
15
- exports[`base32.decode cases MZXW6YTB 1`] = `"fooba"`;
16
-
17
- exports[`base32.decode cases MZXW6YTBOI====== 1`] = `"foobar"`;
18
-
19
- exports[`base32.decode cases case: 1 1`] = `""`;
20
-
21
- exports[`base32.decode cases mzxw6ytb 1`] = `"fooba"`;
@@ -1,15 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`base32.encode case: 1 1`] = `""`;
4
-
5
- exports[`base32.encode f 1`] = `"MY======"`;
6
-
7
- exports[`base32.encode fo 1`] = `"MZXQ===="`;
8
-
9
- exports[`base32.encode foo 1`] = `"MZXW6==="`;
10
-
11
- exports[`base32.encode foob 1`] = `"MZXW6YQ="`;
12
-
13
- exports[`base32.encode fooba 1`] = `"MZXW6YTB"`;
14
-
15
- exports[`base32.encode foobar 1`] = `"MZXW6YTBOI======"`;
@@ -1,95 +0,0 @@
1
- import { getConnections, PgTestClient } from 'pgsql-test';
2
- import cases from 'jest-in-case';
3
-
4
- let pg: PgTestClient;
5
- let teardown: () => Promise<void>;
6
-
7
- beforeAll(async () => {
8
- ({ pg, teardown } = await getConnections());
9
- });
10
-
11
- afterAll(async () => {
12
- await teardown();
13
- });
14
-
15
-
16
- it('base32_to_decimal', async () => {
17
- const { base32_to_decimal } = await pg.one(
18
- `SELECT base32.base32_to_decimal($1::text) AS base32_to_decimal`,
19
- ['INQXI===']
20
- );
21
- expect(base32_to_decimal).toEqual(['8', '13', '16', '23', '8', '=', '=', '=']);
22
- });
23
-
24
- it('decimal_to_chunks', async () => {
25
- const { decimal_to_chunks } = await pg.one(
26
- `SELECT base32.decimal_to_chunks($1::text[]) AS decimal_to_chunks`,
27
- [['8', '13', '16', '23', '8', '=', '=', '=']]
28
- );
29
- expect(decimal_to_chunks).toEqual([
30
- '01000',
31
- '01101',
32
- '10000',
33
- '10111',
34
- '01000',
35
- 'xxxxx',
36
- 'xxxxx',
37
- 'xxxxx'
38
- ]);
39
- });
40
-
41
- it('decode', async () => {
42
- const { decode } = await pg.one(
43
- `SELECT base32.decode($1::text) AS decode`,
44
- ['INQXI']
45
- );
46
- expect(decode).toEqual('Cat');
47
- });
48
-
49
- it('zero_fill', async () => {
50
- const { zero_fill } = await pg.one(
51
- `SELECT base32.zero_fill($1::int, $2::int) AS zero_fill`,
52
- [300, 2]
53
- );
54
- expect(zero_fill).toBe('75');
55
- });
56
-
57
- it('zero_fill (-)', async () => {
58
- const { zero_fill } = await pg.one(
59
- `SELECT base32.zero_fill($1::int, $2::int) AS zero_fill`,
60
- [-300, 2]
61
- );
62
- expect(zero_fill).toBe('1073741749');
63
- });
64
-
65
- it('zero_fill (0)', async () => {
66
- const { zero_fill } = await pg.one(
67
- `SELECT base32.zero_fill($1::int, $2::int) AS zero_fill`,
68
- [-300, 0]
69
- );
70
- expect(zero_fill).toBe('4294966996');
71
- });
72
-
73
- cases(
74
- 'base32.decode cases',
75
- async (opts: { name: string; result: string }) => {
76
- const { decode } = await pg.one(
77
- `SELECT base32.decode($1::text) AS decode`,
78
- [opts.name]
79
- );
80
- expect(decode).toEqual(opts.result);
81
- expect(decode).toMatchSnapshot();
82
- },
83
- [
84
- { result: '', name: '' },
85
- { result: 'Cat', name: 'INQXI' },
86
- { result: 'chemistryisgreat', name: 'MNUGK3LJON2HE6LJONTXEZLBOQ======' },
87
- { result: 'f', name: 'MY======' },
88
- { result: 'fo', name: 'MZXQ====' },
89
- { result: 'foo', name: 'MZXW6===' },
90
- { result: 'foob', name: 'MZXW6YQ=' },
91
- { result: 'fooba', name: 'MZXW6YTB' },
92
- { result: 'fooba', name: 'mzxw6ytb' },
93
- { result: 'foobar', name: 'MZXW6YTBOI======' }
94
- ]
95
- );
@@ -1,137 +0,0 @@
1
- import { getConnections, PgTestClient } from 'pgsql-test';
2
- import cases from 'jest-in-case';
3
-
4
- let pg: PgTestClient;
5
- let teardown: () => Promise<void>;
6
-
7
- beforeAll(async () => {
8
- ({ pg, teardown } = await getConnections());
9
- });
10
-
11
- afterAll(async () => {
12
- await teardown();
13
- });
14
-
15
-
16
- it('to_ascii', async () => {
17
- const { to_ascii } = await pg.one(
18
- `SELECT base32.to_ascii($1::text) AS to_ascii`,
19
- ['Cat']
20
- );
21
- expect(to_ascii).toEqual([67, 97, 116]);
22
- });
23
-
24
- it('to_binary', async () => {
25
- const { to_ascii } = await pg.one(
26
- `SELECT base32.to_ascii($1::text) AS to_ascii`,
27
- ['Cat']
28
- );
29
- const { to_binary } = await pg.one(
30
- `SELECT base32.to_binary($1::int[]) AS to_binary`,
31
- [to_ascii]
32
- );
33
- expect(to_binary).toEqual(['01000011', '01100001', '01110100']);
34
- });
35
-
36
- it('to_groups', async () => {
37
- const { to_groups } = await pg.one(
38
- `SELECT base32.to_groups($1::text[]) AS to_groups`,
39
- [['01000011', '01100001', '01110100']]
40
- );
41
- expect(to_groups).toEqual([
42
- '01000011',
43
- '01100001',
44
- '01110100',
45
- 'xxxxxxxx',
46
- 'xxxxxxxx'
47
- ]);
48
- });
49
-
50
- it('to_chunks', async () => {
51
- const { to_chunks } = await pg.one(
52
- `SELECT base32.to_chunks($1::text[]) AS to_chunks`,
53
- [['01000011', '01100001', '01110100', 'xxxxxxxx', 'xxxxxxxx']]
54
- );
55
- expect(to_chunks).toEqual([
56
- '01000',
57
- '01101',
58
- '10000',
59
- '10111',
60
- '0100x',
61
- 'xxxxx',
62
- 'xxxxx',
63
- 'xxxxx'
64
- ]);
65
- });
66
-
67
- it('fill_chunks', async () => {
68
- const { fill_chunks } = await pg.one(
69
- `SELECT base32.fill_chunks($1::text[]) AS fill_chunks`,
70
- [[
71
- '01000',
72
- '01101',
73
- '10000',
74
- '10111',
75
- '0100x',
76
- 'xxxxx',
77
- 'xxxxx',
78
- 'xxxxx'
79
- ]]
80
- );
81
- expect(fill_chunks).toEqual([
82
- '01000',
83
- '01101',
84
- '10000',
85
- '10111',
86
- '01000',
87
- 'xxxxx',
88
- 'xxxxx',
89
- 'xxxxx'
90
- ]);
91
- });
92
-
93
- it('to_decimal', async () => {
94
- const { to_decimal } = await pg.one(
95
- `SELECT base32.to_decimal($1::text[]) AS to_decimal`,
96
- [[
97
- '01000',
98
- '01101',
99
- '10000',
100
- '10111',
101
- '01000',
102
- 'xxxxx',
103
- 'xxxxx',
104
- 'xxxxx'
105
- ]]
106
- );
107
- expect(to_decimal).toEqual(['8', '13', '16', '23', '8', '=', '=', '=']);
108
- });
109
-
110
- it('to_base32', async () => {
111
- const { to_base32 } = await pg.one(
112
- `SELECT base32.to_base32($1::text[]) AS to_base32`,
113
- [['8', '13', '16', '23', '8', '=', '=', '=']]
114
- );
115
- expect(to_base32).toEqual('INQXI===');
116
- });
117
-
118
- cases(
119
- 'base32.encode',
120
- async (opts: { name: string; result: string }) => {
121
- const { encode } = await pg.one(
122
- `SELECT base32.encode($1::text) AS encode`,
123
- [opts.name]
124
- );
125
- expect(encode).toEqual(opts.result);
126
- expect(encode).toMatchSnapshot();
127
- },
128
- [
129
- { name: '', result: '' },
130
- { name: 'f', result: 'MY======' },
131
- { name: 'fo', result: 'MZXQ====' },
132
- { name: 'foo', result: 'MZXW6===' },
133
- { name: 'foob', result: 'MZXW6YQ=' },
134
- { name: 'fooba', result: 'MZXW6YTB' },
135
- { name: 'foobar', result: 'MZXW6YTBOI======' }
136
- ]
137
- );