@learncard/claimable-boosts-plugin 1.1.30 → 1.1.32

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,qBAAqB,EACrB,qCAAqC,EAExC,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,cAAc,SAAS,CAAC;AAIxB;;GAEG;AACH,eAAO,MAAM,wBAAwB,cACtB,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,qCAAqC,CAAC,KACtE,qBAiBF,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EACH,qBAAqB,EACrB,qCAAqC,EAExC,MAAM,SAAS,CAAC;AAEjB,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAE5C,cAAc,SAAS,CAAC;AAIxB;;GAEG;AACH,eAAO,MAAM,wBAAwB,GACjC,WAAW,SAAS,CAAC,GAAG,EAAE,GAAG,EAAE,qCAAqC,CAAC,KACtE,qBAiBF,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@learncard/claimable-boosts-plugin",
3
- "version": "1.1.30",
3
+ "version": "1.1.32",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -24,9 +24,9 @@
24
24
  ],
25
25
  "scripts": {
26
26
  "build": "node ./scripts/build.mjs && shx cp ./scripts/mixedEntypoint.js ./dist/index.cjs && tsc --p tsconfig.json && shx cp ./dist/index.d.ts ./dist/index.d.cts",
27
- "test": "jest --passWithNoTests",
28
- "test:watch": "jest --watch",
29
- "test:coverage": "jest --silent --ci --coverage --coverageReporters=\"text\" --coverageReporters=\"text-summary\""
27
+ "test": "vitest run",
28
+ "test:watch": "vitest",
29
+ "test:coverage": "vitest run --coverage"
30
30
  },
31
31
  "author": "Learning Economy Foundation (www.learningeconomy.io)",
32
32
  "license": "MIT",
@@ -39,20 +39,16 @@
39
39
  "url": "https://github.com/learningeconomy/LearnCard/issues"
40
40
  },
41
41
  "devDependencies": {
42
- "@types/jest": "^29.2.2",
43
42
  "@types/node": "^17.0.31",
44
43
  "aqu": "0.4.3",
45
44
  "esbuild": "^0.27.1",
46
- "esbuild-jest": "^0.5.0",
47
45
  "esbuild-plugin-copy": "^1.3.0",
48
- "jest": "^29.3.0",
49
- "shx": "^0.3.4",
50
- "ts-jest": "^29.0.3"
46
+ "shx": "^0.3.4"
51
47
  },
52
48
  "types": "./dist/index.d.ts",
53
49
  "dependencies": {
54
- "@learncard/core": "9.4.30",
55
- "@learncard/types": "5.18.1"
50
+ "@learncard/core": "9.4.32",
51
+ "@learncard/types": "5.18.3"
56
52
  },
57
53
  "sideEffects": false
58
54
  }
@@ -1,3 +1,4 @@
1
+ import { vi } from 'vitest';
1
2
  import { getClaimableBoostsPlugin } from '../';
2
3
 
3
4
  describe('Claimable Boosts Plugin', () => {
@@ -8,8 +9,8 @@ describe('Claimable Boosts Plugin', () => {
8
9
  it('returns a plugin', () => {
9
10
  const plugin = getClaimableBoostsPlugin({
10
11
  invoke: {
11
- generateClaimLink: jest.fn(),
12
- getRegisteredSigningAuthorities: jest.fn(),
12
+ generateClaimLink: vi.fn(),
13
+ getRegisteredSigningAuthorities: vi.fn(),
13
14
  },
14
15
  } as any);
15
16
  expect(plugin).toBeDefined();
@@ -18,22 +19,24 @@ describe('Claimable Boosts Plugin', () => {
18
19
  it('returns a plugin with the correct name', () => {
19
20
  const plugin = getClaimableBoostsPlugin({
20
21
  invoke: {
21
- generateClaimLink: jest.fn(),
22
- getRegisteredSigningAuthorities: jest.fn(),
22
+ generateClaimLink: vi.fn(),
23
+ getRegisteredSigningAuthorities: vi.fn(),
23
24
  },
24
25
  } as any);
25
26
  expect(plugin.name).toBe('ClaimableBoosts');
26
27
  });
27
28
 
28
29
  it('generates a claim link for a boost', async () => {
29
- const mockGenerateClaimLink = jest.fn().mockResolvedValue({
30
+ const mockGenerateClaimLink = vi.fn().mockResolvedValue({
30
31
  boostUri: 'test-uri',
31
- challenge: 'test-challenge'
32
+ challenge: 'test-challenge',
32
33
  });
33
- const mockGetRegisteredSigningAuthorities = jest.fn().mockResolvedValue([{
34
- relationship: { name: 'test-name' },
35
- signingAuthority: { endpoint: 'test-endpoint' }
36
- }]);
34
+ const mockGetRegisteredSigningAuthorities = vi.fn().mockResolvedValue([
35
+ {
36
+ relationship: { name: 'test-name' },
37
+ signingAuthority: { endpoint: 'test-endpoint' },
38
+ },
39
+ ]);
37
40
 
38
41
  const mockLearnCard = {
39
42
  invoke: {
@@ -44,13 +47,22 @@ describe('Claimable Boosts Plugin', () => {
44
47
 
45
48
  const plugin = getClaimableBoostsPlugin(mockLearnCard as any);
46
49
 
47
- const result = await plugin.methods.generateBoostClaimLink(mockLearnCard as any, 'test-boost-uri');
48
- expect(result).toBe('https://learncard.app/claim/boost?claim=true&boostUri=test-uri&challenge=test-challenge');
49
-
50
+ const result = await plugin.methods.generateBoostClaimLink(
51
+ mockLearnCard as any,
52
+ 'test-boost-uri'
53
+ );
54
+ expect(result).toBe(
55
+ 'https://learncard.app/claim/boost?claim=true&boostUri=test-uri&challenge=test-challenge'
56
+ );
57
+
50
58
  expect(mockGetRegisteredSigningAuthorities).toHaveBeenCalled();
51
- expect(mockGenerateClaimLink).toHaveBeenCalledWith('test-boost-uri', {
52
- name: 'test-name',
53
- endpoint: 'test-endpoint'
54
- }, undefined);
59
+ expect(mockGenerateClaimLink).toHaveBeenCalledWith(
60
+ 'test-boost-uri',
61
+ {
62
+ name: 'test-name',
63
+ endpoint: 'test-endpoint',
64
+ },
65
+ undefined
66
+ );
55
67
  });
56
68
  });