Merge pull request #810 from h3poteto/iss-209
refs #209 Add Login store unit tests
This commit is contained in:
commit
8a5b8f9992
|
@ -2915,6 +2915,13 @@
|
||||||
"requires": {
|
"requires": {
|
||||||
"core-js": "2.5.7",
|
"core-js": "2.5.7",
|
||||||
"regenerator-runtime": "0.11.1"
|
"regenerator-runtime": "0.11.1"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"regenerator-runtime": {
|
||||||
|
"version": "0.11.1",
|
||||||
|
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
|
||||||
|
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"babel-template": {
|
"babel-template": {
|
||||||
|
@ -15677,9 +15684,10 @@
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"regenerator-runtime": {
|
"regenerator-runtime": {
|
||||||
"version": "0.11.1",
|
"version": "0.13.1",
|
||||||
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
|
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.1.tgz",
|
||||||
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
|
"integrity": "sha512-5KzMIyPLvfdPmvsdlYsHqITrDfK9k7bmvf97HvHSN4810i254ponbxCQ1NukpRWlu6en2MBWzAlhDExEKISwAA==",
|
||||||
|
"dev": true
|
||||||
},
|
},
|
||||||
"regenerator-transform": {
|
"regenerator-transform": {
|
||||||
"version": "0.10.1",
|
"version": "0.10.1",
|
||||||
|
|
13
package.json
13
package.json
|
@ -30,7 +30,7 @@
|
||||||
"build:mas": "npm run build:clean && npm run pack && electron-packager ./ 'Whalebird' --platform=mas --arch=x64 --electron-version=3.0.10 --asar.unpackDir='build/sounds' --out=packages --ignore='^/src' --ignore='^/test' --ignore='^/.electron-vue' --ignore='^/.envrc' --ignore='^/packages' --ignore='^/plist' --ignore='^/static' --ignore='^/whalebird.db' --ignore='^/screenshot.png' --prune=true --icon=./build/icons/icon.icns --overwrite --app-bundle-id=org.whalebird.desktop --app-version=$npm_package_config_appVersion --build-version=$npm_package_config_buildVersion --extend-info='./plist/team.plist' --osx-sign --app-category-type=public.app-category.social-networking",
|
"build:mas": "npm run build:clean && npm run pack && electron-packager ./ 'Whalebird' --platform=mas --arch=x64 --electron-version=3.0.10 --asar.unpackDir='build/sounds' --out=packages --ignore='^/src' --ignore='^/test' --ignore='^/.electron-vue' --ignore='^/.envrc' --ignore='^/packages' --ignore='^/plist' --ignore='^/static' --ignore='^/whalebird.db' --ignore='^/screenshot.png' --prune=true --icon=./build/icons/icon.icns --overwrite --app-bundle-id=org.whalebird.desktop --app-version=$npm_package_config_appVersion --build-version=$npm_package_config_buildVersion --extend-info='./plist/team.plist' --osx-sign --app-category-type=public.app-category.social-networking",
|
||||||
"dev": "node .electron-vue/dev-runner.js",
|
"dev": "node .electron-vue/dev-runner.js",
|
||||||
"e2e": "npm run pack && mocha test/e2e",
|
"e2e": "npm run pack && mocha test/e2e",
|
||||||
"lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src test",
|
"lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src spec",
|
||||||
"lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src test",
|
"lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src test",
|
||||||
"stylelint": "stylelint '**/*.vue' --syntax scss",
|
"stylelint": "stylelint '**/*.vue' --syntax scss",
|
||||||
"pack": "npm run pack:main && npm run pack:renderer",
|
"pack": "npm run pack:main && npm run pack:renderer",
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
"test": "npm run unit && npm run e2e",
|
"test": "npm run unit && npm run e2e",
|
||||||
"unit": "karma start test/unit/karma.conf.js",
|
"unit": "karma start test/unit/karma.conf.js",
|
||||||
"postinstall": "npm run lint:fix",
|
"postinstall": "npm run lint:fix",
|
||||||
"spec:unit": "BABEL_ENV=test jest -u ./spec/unit/*.spec.js"
|
"spec:unit": "BABEL_ENV=test jest -u ./spec/unit/*/**.spec.js"
|
||||||
},
|
},
|
||||||
"build": {
|
"build": {
|
||||||
"productName": "Whalebird",
|
"productName": "Whalebird",
|
||||||
|
@ -90,6 +90,13 @@
|
||||||
"category": "Network"
|
"category": "Network"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"jest": {
|
||||||
|
"moduleNameMapper": {
|
||||||
|
"^@/(.+)": "<rootDir>/src/renderer/$1",
|
||||||
|
"^~/(.+)": "<rootDir>/$1",
|
||||||
|
"electron": "<rootDir>/spec/mock/electron.js"
|
||||||
|
}
|
||||||
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@panter/vue-i18next": "^0.13.0",
|
"@panter/vue-i18next": "^0.13.0",
|
||||||
"@trodi/electron-splashscreen": "^0.3.4",
|
"@trodi/electron-splashscreen": "^0.3.4",
|
||||||
|
@ -138,6 +145,7 @@
|
||||||
"ajv": "^6.6.1",
|
"ajv": "^6.6.1",
|
||||||
"babel-core": "^6.26.3",
|
"babel-core": "^6.26.3",
|
||||||
"babel-eslint": "^10.0.1",
|
"babel-eslint": "^10.0.1",
|
||||||
|
"babel-jest": "^23.6.0",
|
||||||
"babel-loader": "^7.1.4",
|
"babel-loader": "^7.1.4",
|
||||||
"babel-minify-webpack-plugin": "^0.3.1",
|
"babel-minify-webpack-plugin": "^0.3.1",
|
||||||
"babel-plugin-istanbul": "^5.1.0",
|
"babel-plugin-istanbul": "^5.1.0",
|
||||||
|
@ -184,6 +192,7 @@
|
||||||
"multispinner": "^0.2.1",
|
"multispinner": "^0.2.1",
|
||||||
"node-loader": "^0.6.0",
|
"node-loader": "^0.6.0",
|
||||||
"node-sass": "^4.10.0",
|
"node-sass": "^4.10.0",
|
||||||
|
"regenerator-runtime": "^0.13.1",
|
||||||
"sass-loader": "^7.0.3",
|
"sass-loader": "^7.0.3",
|
||||||
"style-loader": "^0.23.1",
|
"style-loader": "^0.23.1",
|
||||||
"stylelint": "^9.9.0",
|
"stylelint": "^9.9.0",
|
||||||
|
|
|
@ -4,6 +4,7 @@ linter:
|
||||||
dir:
|
dir:
|
||||||
- src
|
- src
|
||||||
- test
|
- test
|
||||||
|
- spec
|
||||||
options:
|
options:
|
||||||
config: '.eslintrc.js'
|
config: '.eslintrc.js'
|
||||||
ext: '.js,.vue'
|
ext: '.js,.vue'
|
||||||
|
|
|
@ -0,0 +1,5 @@
|
||||||
|
{
|
||||||
|
"env": {
|
||||||
|
"jest": true
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,6 @@
|
||||||
|
export const ipcRenderer = {
|
||||||
|
send: jest.fn(),
|
||||||
|
on: jest.fn(),
|
||||||
|
once: jest.fn(),
|
||||||
|
removeAllListeners: jest.fn()
|
||||||
|
}
|
|
@ -0,0 +1,56 @@
|
||||||
|
import axios from 'axios'
|
||||||
|
import Login from '@/store/Login'
|
||||||
|
import { ipcRenderer } from '~/spec/mock/electron'
|
||||||
|
|
||||||
|
jest.mock('axios')
|
||||||
|
|
||||||
|
describe('Login', () => {
|
||||||
|
describe('mutations', () => {
|
||||||
|
let state
|
||||||
|
beforeEach(() => {
|
||||||
|
state = {
|
||||||
|
instances: [],
|
||||||
|
selectedInstance: null,
|
||||||
|
searching: false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
describe('changeInstance', () => {
|
||||||
|
it('should be changed', () => {
|
||||||
|
Login.mutations.changeInstance(state, 'pleroma.io')
|
||||||
|
expect(state.selectedInstance).toEqual('pleroma.io')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
describe('changeSearching', () => {
|
||||||
|
it('should be changed', () => {
|
||||||
|
Login.mutations.changeSearching(state, true)
|
||||||
|
expect(state.searching).toEqual(true)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('actions', () => {
|
||||||
|
describe('fetchLogin', async () => {
|
||||||
|
const commitMock = jest.fn()
|
||||||
|
await Login.actions.fetchLogin({ commit: commitMock }, 'pleroma.io')
|
||||||
|
expect(ipcRenderer.send).toHaveBeenCalledWith('get-auth-url', 'pleroma.io')
|
||||||
|
})
|
||||||
|
describe('pageBack', () => {
|
||||||
|
const commitMock = jest.fn()
|
||||||
|
Login.actions.pageBack({ commit: commitMock })
|
||||||
|
expect(commitMock).toHaveBeenCalledWith('changeInstance', null)
|
||||||
|
})
|
||||||
|
describe('confirmInstance', async () => {
|
||||||
|
const resp = {
|
||||||
|
data: 'test'
|
||||||
|
}
|
||||||
|
// Provide Promise.resolve for finally keywrod.
|
||||||
|
// https://github.com/facebook/jest/issues/6552
|
||||||
|
axios.get.mockReturnValue(Promise.resolve(resp))
|
||||||
|
const commitMock = jest.fn()
|
||||||
|
const data = await Login.actions.confirmInstance({ commit: commitMock }, 'pleroma.io')
|
||||||
|
expect(data).toEqual('test')
|
||||||
|
// ref: https://eddyerburgh.me/how-to-unit-test-a-vuex-store
|
||||||
|
expect(commitMock).toHaveBeenCalledWith('changeInstance', 'pleroma.io')
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
|
@ -1,5 +1,4 @@
|
||||||
import assert from 'assert'
|
import emojify from '@/utils/emojify'
|
||||||
import emojify from '../../src/renderer/utils/emojify'
|
|
||||||
|
|
||||||
describe('emojify', () => {
|
describe('emojify', () => {
|
||||||
const emoji = [
|
const emoji = [
|
||||||
|
@ -20,18 +19,14 @@ describe('emojify', () => {
|
||||||
const str = 'I have a pen.'
|
const str = 'I have a pen.'
|
||||||
it('should not change', () => {
|
it('should not change', () => {
|
||||||
const result = emojify(str, emoji)
|
const result = emojify(str, emoji)
|
||||||
assert.strictEqual(
|
expect(result).toEqual(str)
|
||||||
result,
|
|
||||||
str
|
|
||||||
)
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('Contain a shortcode', () => {
|
describe('Contain a shortcode', () => {
|
||||||
const str = 'I like :python:'
|
const str = 'I like :python:'
|
||||||
it('should replace', () => {
|
it('should replace', () => {
|
||||||
const result = emojify(str, emoji)
|
const result = emojify(str, emoji)
|
||||||
assert.strictEqual(
|
expect(result).toEqual(
|
||||||
result,
|
|
||||||
'I like <img draggable="false" class="emojione" alt="python" title="python" src="https://example.com/python" />'
|
'I like <img draggable="false" class="emojione" alt="python" title="python" src="https://example.com/python" />'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -40,8 +35,7 @@ describe('emojify', () => {
|
||||||
const str = 'I like :python: , :nodejs: and :slack:'
|
const str = 'I like :python: , :nodejs: and :slack:'
|
||||||
it('should replace', () => {
|
it('should replace', () => {
|
||||||
const result = emojify(str, emoji)
|
const result = emojify(str, emoji)
|
||||||
assert.strictEqual(
|
expect(result).toEqual(
|
||||||
result,
|
|
||||||
'I like <img draggable="false" class="emojione" alt="python" title="python" src="https://example.com/python" /> , <img draggable="false" class="emojione" alt="nodejs" title="nodejs" src="https://example.com/nodejs" /> and <img draggable="false" class="emojione" alt="slack" title="slack" src="https://example.com/slack" />'
|
'I like <img draggable="false" class="emojione" alt="python" title="python" src="https://example.com/python" /> , <img draggable="false" class="emojione" alt="nodejs" title="nodejs" src="https://example.com/nodejs" /> and <img draggable="false" class="emojione" alt="slack" title="slack" src="https://example.com/slack" />'
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
@ -50,8 +44,7 @@ describe('emojify', () => {
|
||||||
const str = 'I like :python: , I love :python:'
|
const str = 'I like :python: , I love :python:'
|
||||||
it('should replace', () => {
|
it('should replace', () => {
|
||||||
const result = emojify(str, emoji)
|
const result = emojify(str, emoji)
|
||||||
assert.strictEqual(
|
expect(result).toEqual(
|
||||||
result,
|
|
||||||
'I like <img draggable="false" class="emojione" alt="python" title="python" src="https://example.com/python" /> , I love <img draggable="false" class="emojione" alt="python" title="python" src="https://example.com/python" />'
|
'I like <img draggable="false" class="emojione" alt="python" title="python" src="https://example.com/python" /> , I love <img draggable="false" class="emojione" alt="python" title="python" src="https://example.com/python" />'
|
||||||
)
|
)
|
||||||
})
|
})
|
|
@ -1,45 +1,44 @@
|
||||||
import assert from 'assert'
|
import suggestText from '@/utils/suggestText'
|
||||||
import suggestText from '../../src/renderer/utils/suggestText'
|
|
||||||
|
|
||||||
describe('account', () => {
|
describe('account', () => {
|
||||||
describe('Only account name', () => {
|
describe('Only account name', () => {
|
||||||
const str = '@h3pote'
|
const str = '@h3pote'
|
||||||
it('should match', () => {
|
it('should match', () => {
|
||||||
const [start, word] = suggestText(str, 7)
|
const [start, word] = suggestText(str, 7)
|
||||||
assert.strictEqual(str, word)
|
expect(str).toEqual(word)
|
||||||
assert.strictEqual(start, 1)
|
expect(start).toEqual(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('Beginning of the sentence', () => {
|
describe('Beginning of the sentence', () => {
|
||||||
const str = '@h3pote toot body'
|
const str = '@h3pote toot body'
|
||||||
it('should match', () => {
|
it('should match', () => {
|
||||||
const [start, word] = suggestText(str, 7)
|
const [start, word] = suggestText(str, 7)
|
||||||
assert.strictEqual(word, '@h3pote')
|
expect(word).toEqual('@h3pote')
|
||||||
assert.strictEqual(start, 1)
|
expect(start).toEqual(1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('Halfway of the sentence', () => {
|
describe('Halfway of the sentence', () => {
|
||||||
const str = 'toot body @h3pote toot'
|
const str = 'toot body @h3pote toot'
|
||||||
it('should match', () => {
|
it('should match', () => {
|
||||||
const [start, word] = suggestText(str, 17)
|
const [start, word] = suggestText(str, 17)
|
||||||
assert.strictEqual(word, '@h3pote')
|
expect(word).toEqual('@h3pote')
|
||||||
assert.strictEqual(start, 11)
|
expect(start).toEqual(11)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('End of the sentence', () => {
|
describe('End of the sentence', () => {
|
||||||
const str = 'toot body @h3pote'
|
const str = 'toot body @h3pote'
|
||||||
it('should match', () => {
|
it('should match', () => {
|
||||||
const [start, word] = suggestText(str, 17)
|
const [start, word] = suggestText(str, 17)
|
||||||
assert.strictEqual(word, '@h3pote')
|
expect(word).toEqual('@h3pote')
|
||||||
assert.strictEqual(start, 11)
|
expect(start).toEqual(11)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('No space', () => {
|
describe('No space', () => {
|
||||||
const str = 'tootbody@h3pote'
|
const str = 'tootbody@h3pote'
|
||||||
it('should not match', () => {
|
it('should not match', () => {
|
||||||
const [start, word] = suggestText(str, 15)
|
const [start, word] = suggestText(str, 15)
|
||||||
assert.strictEqual(word, null)
|
expect(word).toEqual(null)
|
||||||
assert.strictEqual(start, null)
|
expect(start).toEqual(null)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
|
@ -1,6 +1,5 @@
|
||||||
import assert from 'assert'
|
|
||||||
import { JSDOM } from 'jsdom'
|
import { JSDOM } from 'jsdom'
|
||||||
import { findLink, findTag, findAccount } from '../../src/renderer/utils/tootParser'
|
import { findLink, findTag, findAccount } from '@/utils/tootParser'
|
||||||
|
|
||||||
describe('findLink', () => {
|
describe('findLink', () => {
|
||||||
describe('Pleroma', () => {
|
describe('Pleroma', () => {
|
||||||
|
@ -16,7 +15,7 @@ I released Whalebird version 2.4.1. In version 2.4.0, Whalebird supports streami
|
||||||
const target = doc.getElementById('link')
|
const target = doc.getElementById('link')
|
||||||
it('should find', () => {
|
it('should find', () => {
|
||||||
const res = findLink(target)
|
const res = findLink(target)
|
||||||
assert.strictEqual(res, 'https://github.com/h3poteto/whalebird-desktop/releases/tag/2.4.1')
|
expect(res).toEqual('https://github.com/h3poteto/whalebird-desktop/releases/tag/2.4.1')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -34,7 +33,7 @@ I released Whalebird version 2.4.1. In version 2.4.0, Whalebird supports streami
|
||||||
const target = doc.getElementById('tag')
|
const target = doc.getElementById('tag')
|
||||||
it('should find', () => {
|
it('should find', () => {
|
||||||
const res = findTag(target)
|
const res = findTag(target)
|
||||||
assert.strictEqual(res, 'whalebird')
|
expect(res).toEqual('whalebird')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -50,7 +49,7 @@ I released Whalebird version 2.4.1. In version 2.4.0, Whalebird supports streami
|
||||||
const target = doc.getElementById('tag')
|
const target = doc.getElementById('tag')
|
||||||
it('should find', () => {
|
it('should find', () => {
|
||||||
const res = findTag(target)
|
const res = findTag(target)
|
||||||
assert.strictEqual(res, 'whalebird')
|
expect(res).toEqual('whalebird')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -67,8 +66,8 @@ describe('findAccount', () => {
|
||||||
const target = doc.getElementById('user')
|
const target = doc.getElementById('user')
|
||||||
it('should find', () => {
|
it('should find', () => {
|
||||||
const res = findAccount(target)
|
const res = findAccount(target)
|
||||||
assert.strictEqual(res.username, '@h3_poteto')
|
expect(res.username).toEqual('@h3_poteto')
|
||||||
assert.strictEqual(res.acct, '@h3_poteto@social.mikutter.hachune.net')
|
expect(res.acct).toEqual('@h3_poteto@social.mikutter.hachune.net')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -82,8 +81,8 @@ describe('findAccount', () => {
|
||||||
const target = doc.getElementById('user')
|
const target = doc.getElementById('user')
|
||||||
it('should find', () => {
|
it('should find', () => {
|
||||||
const res = findAccount(target)
|
const res = findAccount(target)
|
||||||
assert.strictEqual(res.username, '@h3poteto')
|
expect(res.username).toEqual('@h3poteto')
|
||||||
assert.strictEqual(res.acct, '@h3poteto@pleroma.io')
|
expect(res.acct).toEqual('@h3poteto@pleroma.io')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
|
@ -1,5 +1,4 @@
|
||||||
import assert from 'assert'
|
import { domainFormat } from '@/utils/validator'
|
||||||
import { domainFormat } from '../../src/renderer/utils/validator'
|
|
||||||
|
|
||||||
describe('validator', () => {
|
describe('validator', () => {
|
||||||
describe('domainFormat', () => {
|
describe('domainFormat', () => {
|
||||||
|
@ -7,56 +6,56 @@ describe('validator', () => {
|
||||||
const domain = 'https://mastodon.social'
|
const domain = 'https://mastodon.social'
|
||||||
it('should not match', () => {
|
it('should not match', () => {
|
||||||
const res = domain.search(domainFormat)
|
const res = domain.search(domainFormat)
|
||||||
assert.strictEqual(res, -1)
|
expect(res).toEqual(-1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('string contains account name', () => {
|
describe('string contains account name', () => {
|
||||||
const domain = 'h3_poteto@mastodon.social'
|
const domain = 'h3_poteto@mastodon.social'
|
||||||
it('should not match', () => {
|
it('should not match', () => {
|
||||||
const res = domain.search(domainFormat)
|
const res = domain.search(domainFormat)
|
||||||
assert.strictEqual(res, -1)
|
expect(res).toEqual(-1)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('string is gTLD domain', () => {
|
describe('string is gTLD domain', () => {
|
||||||
const domain = 'mastodon.social'
|
const domain = 'mastodon.social'
|
||||||
it('should match', () => {
|
it('should match', () => {
|
||||||
const res = domain.search(domainFormat)
|
const res = domain.search(domainFormat)
|
||||||
assert.strictEqual(res, 0)
|
expect(res).toEqual(0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('string is subdomain', () => {
|
describe('string is subdomain', () => {
|
||||||
const domain = 'music.mastodon.social'
|
const domain = 'music.mastodon.social'
|
||||||
it('should match', () => {
|
it('should match', () => {
|
||||||
const res = domain.search(domainFormat)
|
const res = domain.search(domainFormat)
|
||||||
assert.strictEqual(res, 0)
|
expect(res).toEqual(0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('string is subdomain', () => {
|
describe('string is subdomain', () => {
|
||||||
const domain = 'social.tchncs.de'
|
const domain = 'social.tchncs.de'
|
||||||
it('should match', () => {
|
it('should match', () => {
|
||||||
const res = domain.search(domainFormat)
|
const res = domain.search(domainFormat)
|
||||||
assert.strictEqual(res, 0)
|
expect(res).toEqual(0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('string is jp domain', () => {
|
describe('string is jp domain', () => {
|
||||||
const domain = 'mstdn.co.jp'
|
const domain = 'mstdn.co.jp'
|
||||||
it('should match', () => {
|
it('should match', () => {
|
||||||
const res = domain.search(domainFormat)
|
const res = domain.search(domainFormat)
|
||||||
assert.strictEqual(res, 0)
|
expect(res).toEqual(0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('string contains hyphone', () => {
|
describe('string contains hyphone', () => {
|
||||||
const domain = 'music-mastodon.social'
|
const domain = 'music-mastodon.social'
|
||||||
it('should match', () => {
|
it('should match', () => {
|
||||||
const res = domain.search(domainFormat)
|
const res = domain.search(domainFormat)
|
||||||
assert.strictEqual(res, 0)
|
expect(res).toEqual(0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
describe('string is short domain', () => {
|
describe('string is short domain', () => {
|
||||||
const domain = 'id.cc'
|
const domain = 'id.cc'
|
||||||
it('should match', () => {
|
it('should match', () => {
|
||||||
const res = domain.search(domainFormat)
|
const res = domain.search(domainFormat)
|
||||||
assert.strictEqual(res, 0)
|
expect(res).toEqual(0)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
|
@ -17,7 +17,7 @@ const Login = {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
fetchLogin ({ commit }, instance) {
|
fetchLogin (_, instance) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
ipcRenderer.send('get-auth-url', instance)
|
ipcRenderer.send('get-auth-url', instance)
|
||||||
ipcRenderer.once('error-get-auth-url', (event, err) => {
|
ipcRenderer.once('error-get-auth-url', (event, err) => {
|
||||||
|
|
Loading…
Reference in New Issue