mirror of
https://github.com/bitwarden/jslib
synced 2025-12-22 03:03:15 +00:00
WIP - Split up tests to their proper project
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@bitwarden/jslib-common",
|
||||
"name": "@bitwarden/jslib-angular",
|
||||
"version": "0.0.0",
|
||||
"description": "Common code used across Bitwarden JavaScript projects.",
|
||||
"keywords": [
|
||||
|
||||
83
common/karma.conf.js
Normal file
83
common/karma.conf.js
Normal file
@@ -0,0 +1,83 @@
|
||||
const webpack = require('webpack');
|
||||
|
||||
module.exports = (config) => {
|
||||
config.set({
|
||||
// base path that will be used to resolve all patterns (eg. files, exclude)
|
||||
basePath: '',
|
||||
|
||||
// frameworks to use
|
||||
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
|
||||
frameworks: ['jasmine', 'webpack'],
|
||||
|
||||
// list of files / patterns to load in the browser
|
||||
files: [
|
||||
{ pattern: 'spec/**/*.spec.ts', watched: false },
|
||||
],
|
||||
|
||||
browsers: [
|
||||
'Chrome'
|
||||
],
|
||||
|
||||
// list of files to exclude
|
||||
exclude: [],
|
||||
|
||||
// preprocess matching files before serving them to the browser
|
||||
// available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
|
||||
preprocessors: {
|
||||
'spec/**/*.ts': ['webpack', 'sourcemap'],
|
||||
},
|
||||
|
||||
// test results reporter to use
|
||||
// possible values: 'dots', 'progress'
|
||||
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
|
||||
reporters: ['progress', 'kjhtml'],
|
||||
|
||||
// web server port
|
||||
port: 9876,
|
||||
|
||||
// enable / disable colors in the output (reporters and logs)
|
||||
colors: true,
|
||||
|
||||
// level of logging
|
||||
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
|
||||
logLevel: config.LOG_INFO,
|
||||
|
||||
// Concurrency level
|
||||
// how many browser should be started simultaneous
|
||||
concurrency: Infinity,
|
||||
|
||||
client: {
|
||||
clearContext: false // leave Jasmine Spec Runner output visible in browser
|
||||
},
|
||||
|
||||
webpack: {
|
||||
mode: 'development',
|
||||
resolve: {
|
||||
extensions: ['.js', '.ts', '.tsx'],
|
||||
fallback: {
|
||||
"util": require.resolve("util/"),
|
||||
"url": require.resolve("url/"),
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
new webpack.ProvidePlugin({
|
||||
process: 'process/browser',
|
||||
}),
|
||||
],
|
||||
module: {
|
||||
rules: [
|
||||
{
|
||||
test: /\.tsx?$/,
|
||||
loader: 'ts-loader',
|
||||
},
|
||||
],
|
||||
},
|
||||
stats: {
|
||||
colors: true,
|
||||
modules: true,
|
||||
reasons: true,
|
||||
errorDetails: true,
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
6150
common/package-lock.json
generated
6150
common/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -17,17 +17,37 @@
|
||||
"build": "npm run clean && tsc",
|
||||
"build:watch": "npm run clean && tsc -watch",
|
||||
"lint": "tslint 'src/**/*.ts' 'spec/**/*.ts'",
|
||||
"lint:fix": "tslint 'src/**/*.ts' 'spec/**/*.ts' --fix"
|
||||
"lint:fix": "tslint 'src/**/*.ts' 'spec/**/*.ts' --fix",
|
||||
"test": "karma start --single-run",
|
||||
"test:node": "npm run build && jasmine"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fluffy-spoon/substitute": "^1.208.0",
|
||||
"@types/jasmine": "^3.10.2",
|
||||
"@types/lunr": "^2.3.3",
|
||||
"@types/node": "^14.17.1",
|
||||
"@types/node-forge": "^0.9.7",
|
||||
"@types/papaparse": "^5.2.5",
|
||||
"@types/tldjs": "^2.3.0",
|
||||
"@types/zxcvbn": "^4.4.1",
|
||||
"fs": "^0.0.1-security",
|
||||
"jasmine": "^3.10.0",
|
||||
"jasmine-core": "^3.10.1",
|
||||
"jasmine-ts-console-reporter": "^3.1.1",
|
||||
"jsdom": "^19.0.0",
|
||||
"karma": "^6.3.9",
|
||||
"karma-chrome-launcher": "^3.1.0",
|
||||
"karma-jasmine": "^4.0.1",
|
||||
"karma-jasmine-html-reporter": "^1.7.0",
|
||||
"karma-sourcemap-loader": "^0.3.8",
|
||||
"karma-webpack": "^5.0.0",
|
||||
"path": "^0.12.7",
|
||||
"process": "^0.11.10",
|
||||
"rimraf": "^3.0.2",
|
||||
"typescript": "4.3.5"
|
||||
"ts-loader": "^9.2.6",
|
||||
"typescript": "4.3.5",
|
||||
"url": "^0.11.0",
|
||||
"util": "^0.12.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"@microsoft/signalr": "5.0.10",
|
||||
|
||||
9
common/spec/helpers.ts
Normal file
9
common/spec/helpers.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
// tslint:disable-next-line
|
||||
const TSConsoleReporter = require('jasmine-ts-console-reporter');
|
||||
jasmine.getEnv().clearReporters(); // Clear default console reporter
|
||||
jasmine.getEnv().addReporter(new TSConsoleReporter());
|
||||
|
||||
// Polyfills
|
||||
// tslint:disable-next-line
|
||||
const jsdom: any = require('jsdom');
|
||||
(global as any).DOMParser = new jsdom.JSDOM().window.DOMParser;
|
||||
@@ -1,8 +1,8 @@
|
||||
import { FirefoxCsvImporter as Importer } from 'jslib-common/importers/firefoxCsvImporter';
|
||||
import { FirefoxCsvImporter as Importer } from '../../src/importers/firefoxCsvImporter';
|
||||
|
||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
||||
import { LoginUriView } from 'jslib-common/models/view/loginUriView';
|
||||
import { LoginView } from 'jslib-common/models/view/loginView';
|
||||
import { CipherView } from '../../src/models/view/cipherView';
|
||||
import { LoginUriView } from '../../src/models/view/loginUriView';
|
||||
import { LoginView } from '../../src/models/view/loginView';
|
||||
|
||||
import { data as firefoxAccountsData } from './testData/firefoxCsv/firefoxAccountsData.csv';
|
||||
import { data as simplePasswordData } from './testData/firefoxCsv/simplePasswordData.csv';
|
||||
@@ -1,4 +1,4 @@
|
||||
import { KeePass2XmlImporter as Importer } from 'jslib-common/importers/keepass2XmlImporter';
|
||||
import { KeePass2XmlImporter as Importer } from '../../src/importers/keepass2XmlImporter';
|
||||
|
||||
const TestData: string = `<?xml version="1.0" encoding="utf-8" standalone="yes"?>
|
||||
<KeePassFile>
|
||||
@@ -1,11 +1,11 @@
|
||||
import { LastPassCsvImporter as Importer } from 'jslib-common/importers/lastpassCsvImporter';
|
||||
import { LastPassCsvImporter as Importer } from '../../src/importers/lastpassCsvImporter';
|
||||
|
||||
import { ImportResult } from 'jslib-common/models/domain/importResult';
|
||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
||||
import { FieldView } from 'jslib-common/models/view/fieldView';
|
||||
import { ImportResult } from '../../src/models/domain/importResult';
|
||||
import { CipherView } from '../../src/models/view/cipherView';
|
||||
import { FieldView } from '../../src/models/view/fieldView';
|
||||
|
||||
import { CipherType } from 'jslib-common/enums/cipherType';
|
||||
import { FieldType } from 'jslib-common/enums/fieldType';
|
||||
import { CipherType } from '../../src/enums/cipherType';
|
||||
import { FieldType } from '../../src/enums/fieldType';
|
||||
|
||||
function baseExcept(result: ImportResult) {
|
||||
expect(result).not.toBeNull();
|
||||
@@ -199,4 +199,4 @@ describe('Lastpass CSV Importer', () => {
|
||||
const cipher = result.ciphers[0];
|
||||
expectLogin(cipher);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,9 +1,9 @@
|
||||
import { NordPassCsvImporter as Importer } from 'jslib-common/importers/nordpassCsvImporter';
|
||||
import { NordPassCsvImporter as Importer } from '../../src/importers/nordpassCsvImporter';
|
||||
|
||||
import { CipherType } from 'jslib-common/enums/cipherType';
|
||||
import { SecureNoteType } from 'jslib-common/enums/secureNoteType';
|
||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
||||
import { IdentityView } from 'jslib-common/models/view/identityView';
|
||||
import { CipherType } from '../../src/enums/cipherType';
|
||||
import { SecureNoteType } from '../../src/enums/secureNoteType';
|
||||
import { CipherView } from '../../src/models/view/cipherView';
|
||||
import { IdentityView } from '../../src/models/view/identityView';
|
||||
|
||||
import { data as creditCardData } from './testData/nordpassCsv/nordpass.card.csv';
|
||||
import { data as identityData } from './testData/nordpassCsv/nordpass.identity.csv';
|
||||
@@ -1,5 +1,5 @@
|
||||
import { FieldType } from 'jslib-common/enums/fieldType';
|
||||
import { OnePassword1PifImporter as Importer } from 'jslib-common/importers/onepasswordImporters/onepassword1PifImporter';
|
||||
import { FieldType } from '../../src/enums/fieldType';
|
||||
import { OnePassword1PifImporter as Importer } from '../../src/importers/onepasswordImporters/onepassword1PifImporter';
|
||||
|
||||
const TestData: string = '***aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee***\n' +
|
||||
JSON.stringify({
|
||||
@@ -1,7 +1,7 @@
|
||||
import { OnePasswordMacCsvImporter as Importer } from 'jslib-common/importers/onepasswordImporters/onepasswordMacCsvImporter';
|
||||
import { OnePasswordMacCsvImporter as Importer } from '../../src/importers/onepasswordImporters/onepasswordMacCsvImporter';
|
||||
|
||||
import { CipherType } from 'jslib-common/enums/cipherType';
|
||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
||||
import { CipherType } from '../../src/enums/cipherType';
|
||||
import { CipherView } from '../../src/models/view/cipherView';
|
||||
|
||||
import { data as creditCardData } from './testData/onePasswordCsv/creditCard.mac.csv';
|
||||
import { data as identityData } from './testData/onePasswordCsv/identity.mac.csv';
|
||||
@@ -1,9 +1,9 @@
|
||||
import { OnePasswordWinCsvImporter as Importer } from 'jslib-common/importers/onepasswordImporters/onepasswordWinCsvImporter';
|
||||
import { OnePasswordWinCsvImporter as Importer } from '../../src/importers/onepasswordImporters/onepasswordWinCsvImporter';
|
||||
|
||||
import { CipherType } from 'jslib-common/enums/cipherType';
|
||||
import { FieldType } from 'jslib-common/enums/fieldType';
|
||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
||||
import { FieldView } from 'jslib-common/models/view/fieldView';
|
||||
import { CipherType } from '../../src/enums/cipherType';
|
||||
import { FieldType } from '../../src/enums/fieldType';
|
||||
import { CipherView } from '../../src/models/view/cipherView';
|
||||
import { FieldView } from '../../src/models/view/fieldView';
|
||||
|
||||
import { data as creditCardData } from './testData/onePasswordCsv/creditCard.windows.csv';
|
||||
import { data as identityData } from './testData/onePasswordCsv/identity.windows.csv';
|
||||
@@ -1,2 +1,2 @@
|
||||
export const data = `"UUID","TITLE","SCOPE","AUTOSUBMIT","1: CARDHOLDER NAME","2: NUMBER","3: VERIFICATION NUMBER","4: EXPIRY DATE","SECTION 2: SECTION_PZET7LEKRQXZUINIEGH5ABA2UY","SECTION_PZET7LEKRQXZUINIEGH5ABA2UY 1: LABEL"
|
||||
"sd26pt226etnsijbl3kqzi5bmm","test card","Default","Default","test","4111111111111111","111","1/3/1970 12:23 AM","section","field (phone)"`;
|
||||
export const data = `"UUID","TITLE","SCOPE","AUTOSUBMIT","1: CARDHOLDER NAME","2: NUMBER","3: VERIFICATION NUMBER","4: EXPIRY DATE","SECTION 2: SECTION_PZET7LEKRQXZUINIEGH5ABA2UY","SECTION_PZET7LEKRQXZUINIEGH5ABA2UY 1: LABEL"
|
||||
"sd26pt226etnsijbl3kqzi5bmm","test card","Default","Default","test","4111111111111111","111","1/3/1970 12:23 AM","section","field (phone)"`;
|
||||
@@ -1,2 +1,2 @@
|
||||
export const data = `"UUID","TITLE","SCOPE","AUTOSUBMIT","TAGS","NOTES","SECTION 1: NAME","NAME 1: FIRST NAME","NAME 2: INITIAL","NAME 3: LAST NAME","NAME 4: BIRTH DATE","NAME 5: OCCUPATION","NAME 6: COMPANY","NAME 7: DEPARTMENT","NAME 8: JOB TITLE","SECTION 2: ADDRESS","ADDRESS 1: ADDRESS","ADDRESS 2: DEFAULT PHONE","SECTION 3: INTERNET","INTERNET 1: USERNAME","INTERNET 2: EMAIL","SECTION 4: MFJQKMWEOYDZDFH4YMR7WLJKIY","MFJQKMWEOYDZDFH4YMR7WLJKIY 1: SECTION FIELD","MFJQKMWEOYDZDFH4YMR7WLJKIY 2: SECTION FIELD"
|
||||
"6v56y5z4tejwg37jsettta7d7m","Identity Item","Default","Default","Starter Kit","It’s you! 🖐 Select Edit to fill in more details, like your address and contact information.","Identification","first name","mi","last name","12/2/2020 4:01 AM","occupation","bitwarden","department","job title","Address","address city state zip us","8005555555","Internet Details","userNam3","email@bitwarden.com","💡 Did you know?","1Password can fill names and addresses into webpages:","https://support.1password.com/credit-card-address-filling/"`;
|
||||
export const data = `"UUID","TITLE","SCOPE","AUTOSUBMIT","TAGS","NOTES","SECTION 1: NAME","NAME 1: FIRST NAME","NAME 2: INITIAL","NAME 3: LAST NAME","NAME 4: BIRTH DATE","NAME 5: OCCUPATION","NAME 6: COMPANY","NAME 7: DEPARTMENT","NAME 8: JOB TITLE","SECTION 2: ADDRESS","ADDRESS 1: ADDRESS","ADDRESS 2: DEFAULT PHONE","SECTION 3: INTERNET","INTERNET 1: USERNAME","INTERNET 2: EMAIL","SECTION 4: MFJQKMWEOYDZDFH4YMR7WLJKIY","MFJQKMWEOYDZDFH4YMR7WLJKIY 1: SECTION FIELD","MFJQKMWEOYDZDFH4YMR7WLJKIY 2: SECTION FIELD"
|
||||
"6v56y5z4tejwg37jsettta7d7m","Identity Item","Default","Default","Starter Kit","It’s you! 🖐 Select Edit to fill in more details, like your address and contact information.","Identification","first name","mi","last name","12/2/2020 4:01 AM","occupation","bitwarden","department","job title","Address","address city state zip us","8005555555","Internet Details","userNam3","email@bitwarden.com","💡 Did you know?","1Password can fill names and addresses into webpages:","https://support.1password.com/credit-card-address-filling/"`;
|
||||
@@ -1,5 +1,5 @@
|
||||
export const data = `"UUID","TITLE","USERNAME","PASSWORD","URL","URLS","EMAIL","MASTER-PASSWORD","ACCOUNT-KEY","SCOPE","AUTOSUBMIT","TAGS","NOTES","SECTION 1: WXHDKEQREE3TH6QRFCPFPSD3AE","WXHDKEQREE3TH6QRFCPFPSD3AE 1: SECRET KEY","SECTION 1: NAME","NAME 1: FIRST NAME","NAME 2: INITIAL","NAME 3: LAST NAME","NAME 4: BIRTH DATE","NAME 5: OCCUPATION","NAME 6: COMPANY","NAME 7: DEPARTMENT","NAME 8: JOB TITLE","SECTION 2: ADDRESS","ADDRESS 1: ADDRESS","ADDRESS 2: DEFAULT PHONE","SECTION 3: INTERNET","INTERNET 1: USERNAME","INTERNET 2: EMAIL","SECTION 4: MFJQKMWEOYDZDFH4YMR7WLJKIY","MFJQKMWEOYDZDFH4YMR7WLJKIY 1: SECTION FIELD","MFJQKMWEOYDZDFH4YMR7WLJKIY 2: SECTION FIELD","1: CARDHOLDER NAME","2: NUMBER","3: VERIFICATION NUMBER","4: EXPIRY DATE","SECTION 2: SECTION_PZET7LEKRQXZUINIEGH5ABA2UY","SECTION_PZET7LEKRQXZUINIEGH5ABA2UY 1: LABEL","SECTION 1: 4PQVXPR4BMOPGC3DBMTP5U4OFY","4PQVXPR4BMOPGC3DBMTP5U4OFY 1: SECTION FIELD","4PQVXPR4BMOPGC3DBMTP5U4OFY 2: SECTION FIELD","SECTION 2: M2NTUZZBFOFTPAYXVXE6EMZ5JU","M2NTUZZBFOFTPAYXVXE6EMZ5JU 1: SECTION FIELD","M2NTUZZBFOFTPAYXVXE6EMZ5JU 2: SECTION FIELD","SECTION 3: WC3KPAWH6ZAEQB2ARJB6WYZ3DQ","WC3KPAWH6ZAEQB2ARJB6WYZ3DQ 1: SECTION FIELD","WC3KPAWH6ZAEQB2ARJB6WYZ3DQ 2: SECTION FIELD","WC3KPAWH6ZAEQB2ARJB6WYZ3DQ 3: SECTION FIELD","SECTION 4: TOHUYJEJEMGMI6GEQAZ2LJODFE","TOHUYJEJEMGMI6GEQAZ2LJODFE 1: SECTION FIELD","TOHUYJEJEMGMI6GEQAZ2LJODFE 2: SECTION FIELD","SECTION 5: O26UWJJTXRAANG3ONYYOUUJHDM","O26UWJJTXRAANG3ONYYOUUJHDM 1: SECTION FIELD","O26UWJJTXRAANG3ONYYOUUJHDM 2: WATCH VIDEOS","O26UWJJTXRAANG3ONYYOUUJHDM 3: GET SUPPORT","O26UWJJTXRAANG3ONYYOUUJHDM 4: READ THE BLOG","O26UWJJTXRAANG3ONYYOUUJHDM 5: CONTACT US"
|
||||
"xjq32axcswefpcxu2mtxxqnufa","1Password Account","email@bitwarden.com","the account's password","https://my.1password.com","https://my.1password.com","email@bitwarden.com","the account's password","A3-76TR2N-NJG3TZ-9NXFX-WT8GF-6YQC9-R2659","Default","Default","Starter Kit","You can use this login to sign in to your account on 1password.com.","🔑 Secret Key","the account's secret key","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
|
||||
"6v56y5z4tejwg37jsettta7d7m","Identity Item","","","","","","","","Default","Default","Starter Kit","It’s you! 🖐 Select Edit to fill in more details, like your address and contact information.","","","Identification","first name","mi","last name","12/2/2020 4:01 AM","occupation","bitwarden","department","job title","Address","address city state zip us","8005555555","Internet Details","userNam3","email@bitwarden.com","💡 Did you know?","1Password can fill names and addresses into webpages:","https://support.1password.com/credit-card-address-filling/","","","","","","","","","","","","","","","","","","","","","","","","",""
|
||||
"sd26pt226etnsijbl3kqzi5bmm","test card","","","","","","","","Default","Default","","","","","","","","","","","","","","","","","","","","","","","test","4111111111111111","111","1/3/1970 12:23 AM","section","field (phone)","","","","","","","","","","","","","","","","","","",""
|
||||
"oml2sgit3yk7737kxdis65o4xq","🎉 Welcome to 1Password!","","","","","","","","Default","Default","Starter Kit","Follow these steps to get started.","","","","","","","","","","","","","","","","","","","","","","","","","","","1️⃣ Get the apps","https://1password.com/downloads","Install 1Password everywhere you need your passwords.","2️⃣ Get 1Password in your browser","https://1password.com/downloads/#browsers","Install 1Password in your browser to save and fill passwords.","3️⃣ Save your first password","1. Sign in to your favorite website.","2. 1Password will ask to save your username and password.","3. Click Save Login.","4️⃣ Fill passwords and more","https://support.1password.com/explore/extension/","Save and fill passwords, credit cards, and addresses.","📚 Learn 1Password","Check out our videos and articles:","https://youtube.com/1PasswordVideos","https://support.1password.com/","https://blog.1password.com/","https://support.1password.com/contact-us/"`;
|
||||
export const data = `"UUID","TITLE","USERNAME","PASSWORD","URL","URLS","EMAIL","MASTER-PASSWORD","ACCOUNT-KEY","SCOPE","AUTOSUBMIT","TAGS","NOTES","SECTION 1: WXHDKEQREE3TH6QRFCPFPSD3AE","WXHDKEQREE3TH6QRFCPFPSD3AE 1: SECRET KEY","SECTION 1: NAME","NAME 1: FIRST NAME","NAME 2: INITIAL","NAME 3: LAST NAME","NAME 4: BIRTH DATE","NAME 5: OCCUPATION","NAME 6: COMPANY","NAME 7: DEPARTMENT","NAME 8: JOB TITLE","SECTION 2: ADDRESS","ADDRESS 1: ADDRESS","ADDRESS 2: DEFAULT PHONE","SECTION 3: INTERNET","INTERNET 1: USERNAME","INTERNET 2: EMAIL","SECTION 4: MFJQKMWEOYDZDFH4YMR7WLJKIY","MFJQKMWEOYDZDFH4YMR7WLJKIY 1: SECTION FIELD","MFJQKMWEOYDZDFH4YMR7WLJKIY 2: SECTION FIELD","1: CARDHOLDER NAME","2: NUMBER","3: VERIFICATION NUMBER","4: EXPIRY DATE","SECTION 2: SECTION_PZET7LEKRQXZUINIEGH5ABA2UY","SECTION_PZET7LEKRQXZUINIEGH5ABA2UY 1: LABEL","SECTION 1: 4PQVXPR4BMOPGC3DBMTP5U4OFY","4PQVXPR4BMOPGC3DBMTP5U4OFY 1: SECTION FIELD","4PQVXPR4BMOPGC3DBMTP5U4OFY 2: SECTION FIELD","SECTION 2: M2NTUZZBFOFTPAYXVXE6EMZ5JU","M2NTUZZBFOFTPAYXVXE6EMZ5JU 1: SECTION FIELD","M2NTUZZBFOFTPAYXVXE6EMZ5JU 2: SECTION FIELD","SECTION 3: WC3KPAWH6ZAEQB2ARJB6WYZ3DQ","WC3KPAWH6ZAEQB2ARJB6WYZ3DQ 1: SECTION FIELD","WC3KPAWH6ZAEQB2ARJB6WYZ3DQ 2: SECTION FIELD","WC3KPAWH6ZAEQB2ARJB6WYZ3DQ 3: SECTION FIELD","SECTION 4: TOHUYJEJEMGMI6GEQAZ2LJODFE","TOHUYJEJEMGMI6GEQAZ2LJODFE 1: SECTION FIELD","TOHUYJEJEMGMI6GEQAZ2LJODFE 2: SECTION FIELD","SECTION 5: O26UWJJTXRAANG3ONYYOUUJHDM","O26UWJJTXRAANG3ONYYOUUJHDM 1: SECTION FIELD","O26UWJJTXRAANG3ONYYOUUJHDM 2: WATCH VIDEOS","O26UWJJTXRAANG3ONYYOUUJHDM 3: GET SUPPORT","O26UWJJTXRAANG3ONYYOUUJHDM 4: READ THE BLOG","O26UWJJTXRAANG3ONYYOUUJHDM 5: CONTACT US"
|
||||
"xjq32axcswefpcxu2mtxxqnufa","1Password Account","email@bitwarden.com","the account's password","https://my.1password.com","https://my.1password.com","email@bitwarden.com","the account's password","A3-76TR2N-NJG3TZ-9NXFX-WT8GF-6YQC9-R2659","Default","Default","Starter Kit","You can use this login to sign in to your account on 1password.com.","🔑 Secret Key","the account's secret key","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","","",""
|
||||
"6v56y5z4tejwg37jsettta7d7m","Identity Item","","","","","","","","Default","Default","Starter Kit","It’s you! 🖐 Select Edit to fill in more details, like your address and contact information.","","","Identification","first name","mi","last name","12/2/2020 4:01 AM","occupation","bitwarden","department","job title","Address","address city state zip us","8005555555","Internet Details","userNam3","email@bitwarden.com","💡 Did you know?","1Password can fill names and addresses into webpages:","https://support.1password.com/credit-card-address-filling/","","","","","","","","","","","","","","","","","","","","","","","","",""
|
||||
"sd26pt226etnsijbl3kqzi5bmm","test card","","","","","","","","Default","Default","","","","","","","","","","","","","","","","","","","","","","","test","4111111111111111","111","1/3/1970 12:23 AM","section","field (phone)","","","","","","","","","","","","","","","","","","",""
|
||||
"oml2sgit3yk7737kxdis65o4xq","🎉 Welcome to 1Password!","","","","","","","","Default","Default","Starter Kit","Follow these steps to get started.","","","","","","","","","","","","","","","","","","","","","","","","","","","1️⃣ Get the apps","https://1password.com/downloads","Install 1Password everywhere you need your passwords.","2️⃣ Get 1Password in your browser","https://1password.com/downloads/#browsers","Install 1Password in your browser to save and fill passwords.","3️⃣ Save your first password","1. Sign in to your favorite website.","2. 1Password will ask to save your username and password.","3. Click Save Login.","4️⃣ Fill passwords and more","https://support.1password.com/explore/extension/","Save and fill passwords, credit cards, and addresses.","📚 Learn 1Password","Check out our videos and articles:","https://youtube.com/1PasswordVideos","https://support.1password.com/","https://blog.1password.com/","https://support.1password.com/contact-us/"`;
|
||||
@@ -1,4 +1,4 @@
|
||||
import { sequentialize } from 'jslib-common/misc/sequentialize';
|
||||
import { sequentialize } from '../../src/misc/sequentialize';
|
||||
|
||||
describe('sequentialize decorator', () => {
|
||||
it('should call the function once', async () => {
|
||||
@@ -1,5 +1,5 @@
|
||||
import { sequentialize } from 'jslib-common/misc/sequentialize';
|
||||
import { throttle } from 'jslib-common/misc/throttle';
|
||||
import { sequentialize } from '../../src/misc/sequentialize';
|
||||
import { throttle } from '../../src/misc/throttle';
|
||||
|
||||
describe('throttle decorator', () => {
|
||||
it('should call the function once at a time', async () => {
|
||||
@@ -1,4 +1,4 @@
|
||||
import { Utils } from 'jslib-common/misc/utils';
|
||||
import { Utils } from '../../src/misc/utils';
|
||||
|
||||
describe('Utils Service', () => {
|
||||
describe('getDomain', () => {
|
||||
@@ -1,21 +1,21 @@
|
||||
import { Arg, Substitute, SubstituteOf } from '@fluffy-spoon/substitute';
|
||||
|
||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
||||
import { FileUploadService } from 'jslib-common/abstractions/fileUpload.service';
|
||||
import { I18nService } from 'jslib-common/abstractions/i18n.service';
|
||||
import { LogService } from 'jslib-common/abstractions/log.service';
|
||||
import { SearchService } from 'jslib-common/abstractions/search.service';
|
||||
import { SettingsService } from 'jslib-common/abstractions/settings.service';
|
||||
import { StorageService } from 'jslib-common/abstractions/storage.service';
|
||||
import { UserService } from 'jslib-common/abstractions/user.service';
|
||||
import { Utils } from 'jslib-common/misc/utils';
|
||||
import { Cipher } from 'jslib-common/models/domain/cipher';
|
||||
import { EncArrayBuffer } from 'jslib-common/models/domain/encArrayBuffer';
|
||||
import { EncString } from 'jslib-common/models/domain/encString';
|
||||
import { SymmetricCryptoKey } from 'jslib-common/models/domain/symmetricCryptoKey';
|
||||
import { ApiService } from '../../src/abstractions/api.service';
|
||||
import { CryptoService } from '../../src/abstractions/crypto.service';
|
||||
import { FileUploadService } from '../../src/abstractions/fileUpload.service';
|
||||
import { I18nService } from '../../src/abstractions/i18n.service';
|
||||
import { LogService } from '../../src/abstractions/log.service';
|
||||
import { SearchService } from '../../src/abstractions/search.service';
|
||||
import { SettingsService } from '../../src/abstractions/settings.service';
|
||||
import { StorageService } from '../../src/abstractions/storage.service';
|
||||
import { UserService } from '../../src/abstractions/user.service';
|
||||
import { Utils } from '../../src/misc/utils';
|
||||
import { Cipher } from '../../src/models/domain/cipher';
|
||||
import { EncArrayBuffer } from '../../src/models/domain/encArrayBuffer';
|
||||
import { EncString } from '../../src/models/domain/encString';
|
||||
import { SymmetricCryptoKey } from '../../src/models/domain/symmetricCryptoKey';
|
||||
|
||||
import { CipherService } from 'jslib-common/services/cipher.service';
|
||||
import { CipherService } from '../../src/services/cipher.service';
|
||||
|
||||
const ENCRYPTED_TEXT = 'This data has been encrypted';
|
||||
const ENCRYPTED_BYTES = new EncArrayBuffer(Utils.fromUtf8ToArray(ENCRYPTED_TEXT).buffer);
|
||||
@@ -1,4 +1,4 @@
|
||||
import { ConsoleLogService } from 'jslib-common/services/consoleLog.service';
|
||||
import { ConsoleLogService } from '../../src/services/consoleLog.service';
|
||||
|
||||
const originalConsole = console;
|
||||
let caughtMessage: any;
|
||||
@@ -1,22 +1,22 @@
|
||||
import { Substitute, SubstituteOf } from '@fluffy-spoon/substitute';
|
||||
|
||||
import { ApiService } from 'jslib-common/abstractions/api.service';
|
||||
import { CipherService } from 'jslib-common/abstractions/cipher.service';
|
||||
import { CryptoService } from 'jslib-common/abstractions/crypto.service';
|
||||
import { FolderService } from 'jslib-common/abstractions/folder.service';
|
||||
import { ApiService } from '../../src/abstractions/api.service';
|
||||
import { CipherService } from '../../src/abstractions/cipher.service';
|
||||
import { CryptoService } from '../../src/abstractions/crypto.service';
|
||||
import { FolderService } from '../../src/abstractions/folder.service';
|
||||
|
||||
import { ExportService } from 'jslib-common/services/export.service';
|
||||
import { ExportService } from '../../src/services/export.service';
|
||||
|
||||
import { Cipher } from 'jslib-common/models/domain/cipher';
|
||||
import { EncString } from 'jslib-common/models/domain/encString';
|
||||
import { Login } from 'jslib-common/models/domain/login';
|
||||
import { CipherWithIds as CipherExport } from 'jslib-common/models/export/cipherWithIds';
|
||||
import { Cipher } from '../../src/models/domain/cipher';
|
||||
import { EncString } from '../../src/models/domain/encString';
|
||||
import { Login } from '../../src/models/domain/login';
|
||||
import { CipherWithIds as CipherExport } from '../../src/models/export/cipherWithIds';
|
||||
|
||||
import { CipherType } from 'jslib-common/enums/cipherType';
|
||||
import { CipherView } from 'jslib-common/models/view/cipherView';
|
||||
import { LoginView } from 'jslib-common/models/view/loginView';
|
||||
import { CipherType } from '../../src/enums/cipherType';
|
||||
import { CipherView } from '../../src/models/view/cipherView';
|
||||
import { LoginView } from '../../src/models/view/loginView';
|
||||
|
||||
import { BuildTestObject, GetUniqueString } from '../../utils';
|
||||
import { BuildTestObject, GetUniqueString } from '../utils';
|
||||
|
||||
const UserCipherViews = [
|
||||
generateCipherView(false),
|
||||
11
common/spec/support/jasmine.json
Normal file
11
common/spec/support/jasmine.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"spec_dir": "dist/spec",
|
||||
"spec_files": [
|
||||
"**/*[sS]pec.js"
|
||||
],
|
||||
"helpers": [
|
||||
"helpers.js"
|
||||
],
|
||||
"stopSpecOnExpectationFailure": false,
|
||||
"random": true
|
||||
}
|
||||
16
common/spec/utils.ts
Normal file
16
common/spec/utils.ts
Normal file
@@ -0,0 +1,16 @@
|
||||
function newGuid() {
|
||||
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
|
||||
// tslint:disable:no-bitwise
|
||||
const r = Math.random() * 16 | 0;
|
||||
const v = c === 'x' ? r : (r & 0x3 | 0x8);
|
||||
return v.toString(16);
|
||||
});
|
||||
}
|
||||
|
||||
export function GetUniqueString(prefix: string = '') {
|
||||
return prefix + '_' + newGuid();
|
||||
}
|
||||
|
||||
export function BuildTestObject<T, K extends keyof T = keyof T>(def: Partial<Pick<T, K>> | T, constructor?: (new () => T)): T {
|
||||
return Object.assign(constructor === null ? {} : new constructor(), def) as T;
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"rootDir": ".",
|
||||
"pretty": true,
|
||||
"moduleResolution": "node",
|
||||
"noImplicitAny": true,
|
||||
@@ -12,10 +14,7 @@
|
||||
"experimentalDecorators": true,
|
||||
"emitDecoratorMetadata": true,
|
||||
"declarationDir": "dist/types",
|
||||
"outDir": "dist",
|
||||
"typeRoots": [
|
||||
"node_modules/@types"
|
||||
]
|
||||
"outDir": "dist"
|
||||
},
|
||||
"include": [
|
||||
"src",
|
||||
|
||||
12509
package-lock.json
generated
12509
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
40
package.json
40
package.json
@@ -23,40 +23,12 @@
|
||||
"test:node": "npm run build && jasmine",
|
||||
"test:node:watch": "concurrently -k -n TSC,Node -c yellow,cyan \"npm run build:watch\" \"nodemon -w ./dist --delay 500ms --exec jasmine\""
|
||||
},
|
||||
"devDependencies": {
|
||||
"@fluffy-spoon/substitute": "^1.202.0",
|
||||
"@types/jasmine": "^3.7.6",
|
||||
"@types/node": "^14.17.1",
|
||||
"concurrently": "^6.1.0",
|
||||
"jasmine": "^3.7.0",
|
||||
"jasmine-core": "^3.7.1",
|
||||
"jasmine-ts-console-reporter": "^3.1.1",
|
||||
"jsdom": "^16.5.3",
|
||||
"karma": "^6.3.2",
|
||||
"karma-chrome-launcher": "^3.1.0",
|
||||
"karma-cli": "^2.0.0",
|
||||
"karma-detect-browsers": "^2.3.3",
|
||||
"karma-firefox-launcher": "^2.1.0",
|
||||
"karma-jasmine": "^4.0.1",
|
||||
"karma-jasmine-html-reporter": "^1.5.4",
|
||||
"karma-safari-launcher": "^1.0.0",
|
||||
"karma-webpack": "^4.0.2",
|
||||
"nodemon": "^2.0.7",
|
||||
"rimraf": "^3.0.2",
|
||||
"ts-loader": "^8.1.0",
|
||||
"tslint": "^6.1.3",
|
||||
"ttypescript": "^1.5.12",
|
||||
"typemoq": "^2.1.0",
|
||||
"typescript": "4.1.5",
|
||||
"typescript-transform-paths": "^2.2.3",
|
||||
"webpack": "^4.46.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"@bitwarden/jslib-angular": "file:angular",
|
||||
"@bitwarden/jslib-common": "file:common",
|
||||
"@bitwarden/jslib-electron": "file:electron",
|
||||
"@bitwarden/jslib-node": "file:node"
|
||||
},
|
||||
"workspaces": [
|
||||
"common",
|
||||
"angular",
|
||||
"electron",
|
||||
"node"
|
||||
],
|
||||
"engines": {
|
||||
"node": "~14",
|
||||
"npm": "~7"
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
import { ElectronLogService } from 'jslib-electron/services/electronLog.service';
|
||||
|
||||
describe('ElectronLogService', () => {
|
||||
it('sets dev based on electron method', () => {
|
||||
process.env.ELECTRON_IS_DEV = '1';
|
||||
const logService = new ElectronLogService();
|
||||
expect(logService).toEqual(jasmine.objectContaining({ isDev: true }) as any);
|
||||
});
|
||||
});
|
||||
@@ -1,27 +0,0 @@
|
||||
import { cleanUserAgent } from 'jslib-electron/utils';
|
||||
|
||||
const expectedUserAgent = `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/${process.versions.chrome} Safari/537.36`;
|
||||
|
||||
describe('cleanUserAgent', () => {
|
||||
it('cleans mac agent', () => {
|
||||
const initialMacAgent = `Mozilla/5.0 (Macintosh; Intel Mac OS X 11_6_0) AppleWebKit/537.36 (KHTML, like Gecko) Bitwarden/${process.version} Chrome/${process.versions.chrome} Electron/${process.versions.electron} Safari/537.36`;
|
||||
expect(cleanUserAgent(initialMacAgent)).toEqual(expectedUserAgent);
|
||||
});
|
||||
|
||||
it('cleans windows agent', () => {
|
||||
const initialWindowsAgent = `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Bitwarden/${process.version} Chrome/${process.versions.chrome} Electron/${process.versions.electron} Safari/537.36`;
|
||||
expect(cleanUserAgent(initialWindowsAgent)).toEqual(expectedUserAgent);
|
||||
});
|
||||
|
||||
it('cleans linux agent', () => {
|
||||
const initialWindowsAgent = `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Bitwarden/${process.version} Chrome/${process.versions.chrome} Electron/${process.versions.electron} Safari/537.36`;
|
||||
expect(cleanUserAgent(initialWindowsAgent)).toEqual(expectedUserAgent);
|
||||
});
|
||||
|
||||
it('does not change version numbers', () => {
|
||||
const expected = `Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36`;
|
||||
const initialAgent = `Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Bitwarden/1.28.3 Chrome/87.0.4280.141 Electron/11.4.5 Safari/537.36`;
|
||||
|
||||
expect(cleanUserAgent(initialAgent)).toEqual(expected);
|
||||
});
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"spec_dir": "dist/spec",
|
||||
"spec_dir": "dist/common/spec",
|
||||
"spec_files": [
|
||||
"common/**/*[sS]pec.js",
|
||||
"node/**/*[sS]pec.js",
|
||||
|
||||
Reference in New Issue
Block a user