-
Notifications
You must be signed in to change notification settings - Fork 7
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
1 parent
7746528
commit 5af5e57
Showing
3 changed files
with
46 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ module.exports = { | |
testEnvironment: 'node', | ||
coverageThreshold: { | ||
global: { | ||
lines: 18.55 | ||
lines: 81.50 | ||
} | ||
} | ||
} |
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,44 @@ | ||
require('dotenv').config({ path: './.env.local.goerli' }) | ||
import { describe, expect, test } from '@jest/globals' | ||
import { Platform } from '../interfaces' | ||
import { config } from './Config' | ||
import { Passes } from './Passes' | ||
import fs from 'fs' | ||
|
||
test('generatePass - Apple v1', () => { | ||
const platform: Platform = Platform.Apple | ||
const templateVersion: number = 1 | ||
const passportID: string = Math.floor(1 + (Math.random() * 840)).toString() // [1, 840] | ||
const issueDateTimestamp: number = 1662541136 // September 7, 2022 8:58:56 AM | ||
const address: string = '0x394b00B5De4E6f30292aCaC37f810Dd0672E211E' | ||
const ensName: string = 'vitalik.eth' | ||
const filePath: string = Passes.generatePass( | ||
platform, | ||
templateVersion, | ||
passportID, | ||
issueDateTimestamp, | ||
address, | ||
ensName | ||
) | ||
expect(filePath).toContain('passport_0x394b00B5De4E6f30292aCaC37f810Dd0672E211E.pkpass') | ||
expect(fs.existsSync(filePath)).toBe(true) | ||
}) | ||
|
||
test('generatePass - Apple v2', () => { | ||
const platform: Platform = Platform.Apple | ||
const templateVersion: number = 2 | ||
const passportID: string = Math.floor(1 + (Math.random() * 840)).toString() // [1, 840] | ||
const issueDateTimestamp: number = 1662541136 // September 7, 2022 8:58:56 AM | ||
const address: string = '0x394b00B5De4E6f30292aCaC37f810Dd0672E211E' | ||
const ensName: string = 'vitalik.eth' | ||
const filePath: string = Passes.generatePass( | ||
platform, | ||
templateVersion, | ||
passportID, | ||
issueDateTimestamp, | ||
address, | ||
ensName | ||
) | ||
expect(filePath).toContain('passport_0x394b00B5De4E6f30292aCaC37f810Dd0672E211E.pkpass') | ||
expect(fs.existsSync(filePath)).toBe(true) | ||
}) |