Skip to content

Commit

Permalink
test: renew tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ninoseki committed Feb 3, 2024
1 parent e00076b commit 4571e8f
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 172 deletions.
28 changes: 8 additions & 20 deletions frontend/tests/unit/components/bodies/content.spec.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,13 @@
import { createLocalVue, shallowMount } from "@vue/test-utils"
import { describe, expect, it } from "vitest"
import { shallowMount } from '@vue/test-utils'
import { describe, expect, it } from 'vitest'

import Content from "@/components/bodies/Content.vue"
import Content from '@/components/bodies/Content.vue'

const localVue = createLocalVue()

describe("Content.vue", () => {
describe("#codeType", () => {
it("returns plaintext", () => {
const wrapper = shallowMount(Content, {
localVue,
propsData: { content: "foo", contentType: "text/plain" }
})
expect(wrapper.find("code.plaintext"))
})

it("returns html", () => {
const wrapper = shallowMount(Content, {
propsData: { content: "foo", contentType: "text/html" }
})
expect(wrapper.find("code.html"))
describe('Content.vue', () => {
it('returns html', () => {
const wrapper = shallowMount(Content, {
propsData: { content: 'foo', contentType: 'text/html' }
})
expect(wrapper.find('code.html'))
})
})
19 changes: 8 additions & 11 deletions frontend/tests/unit/components/headers/otherHeaders.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { createLocalVue, shallowMount } from "@vue/test-utils"
import { describe, expect, it } from "vitest"
import { shallowMount } from '@vue/test-utils'
import { describe, expect, it } from 'vitest'

import OtherHeaders from "@/components/headers/OtherHeaders.vue"
import { securityKeys } from "@/types"
import OtherHeaders from '@/components/headers/OtherHeaders.vue'
import { securityKeys } from '@/types'

import { header } from "../../fixtures"
import { header } from '../../fixtures'

const localVue = createLocalVue()

describe("OtherHeaders.vue", () => {
describe("#otherHeaders", () => {
it("returns other headers", () => {
describe('OtherHeaders.vue', () => {
describe('#otherHeaders', () => {
it('returns other headers', () => {
const wrapper = shallowMount(OtherHeaders, {
localVue,
propsData: { header }
})

Expand Down
19 changes: 8 additions & 11 deletions frontend/tests/unit/components/headers/securityHeaders.spec.ts
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
import { createLocalVue, shallowMount } from "@vue/test-utils"
import { describe, expect, it } from "vitest"
import { shallowMount } from '@vue/test-utils'
import { describe, expect, it } from 'vitest'

import SecurityHeaders from "@/components/headers/SecurityHeaders.vue"
import { securityKeys } from "@/types"
import SecurityHeaders from '@/components/headers/SecurityHeaders.vue'
import { securityKeys } from '@/types'

import { header } from "../../fixtures"
import { header } from '../../fixtures'

const localVue = createLocalVue()

describe("SecurityHeaders.vue", () => {
describe("#securityHeaders", () => {
it("returns security headers", () => {
describe('SecurityHeaders.vue', () => {
describe('#securityHeaders', () => {
it('returns security headers', () => {
const wrapper = shallowMount(SecurityHeaders, {
localVue,
propsData: { header }
})

Expand Down
17 changes: 7 additions & 10 deletions frontend/tests/unit/components/headers/xheaders.spec.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,14 @@
import { createLocalVue, shallowMount } from "@vue/test-utils"
import { describe, expect, it } from "vitest"
import { shallowMount } from '@vue/test-utils'
import { describe, expect, it } from 'vitest'

import XHeaders from "@/components/headers/XHeaders.vue"
import XHeaders from '@/components/headers/XHeaders.vue'

import { header } from "../../fixtures"
import { header } from '../../fixtures'

const localVue = createLocalVue()

describe("XHeaders.vue", () => {
describe("#xHeaders", () => {
it("returns headers which start with x", () => {
describe('XHeaders.vue', () => {
describe('#xHeaders', () => {
it('returns headers which start with x', () => {
const wrapper = shallowMount(XHeaders, {
localVue,
propsData: { header }
})

Expand Down
22 changes: 0 additions & 22 deletions frontend/tests/unit/components/links/links.spec.ts

This file was deleted.

20 changes: 10 additions & 10 deletions frontend/tests/unit/links/shodan.spec.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,20 @@
import { describe, expect, it } from "vitest"
import { describe, expect, it } from 'vitest'

import { Shodan } from "@/links/shodan"
import { Shodan } from '@/links/shodan'

describe("Shodan", function () {
describe('Shodan', function () {
const subject = new Shodan()

describe("#type", function () {
it("equals to ip_address", function () {
expect(subject.type).toEqual("ip_address")
describe('#type', function () {
it('equals to ip_address', function () {
expect(subject.type).toEqual('ip')
})
})

describe("#href", function () {
it("returns URL", function () {
const value = "1.1.1.1"
expect(subject.href(value)).toEqual("https://www.shodan.io/host/1.1.1.1")
describe('#href', function () {
it('returns URL', function () {
const value = '1.1.1.1'
expect(subject.href(value)).toEqual('https://www.shodan.io/host/1.1.1.1')
})
})
})
52 changes: 26 additions & 26 deletions frontend/tests/unit/links/urlscan.spec.ts
Original file line number Diff line number Diff line change
@@ -1,55 +1,55 @@
import { describe, expect, it } from "vitest"
import { describe, expect, it } from 'vitest'

import { UrlscanForDomain, UrlscanForIP, UrlscanForURL } from "@/links/urlscan"
import { UrlscanForDomain, UrlscanForIP, UrlscanForURL } from '@/links/urlscan'

describe("Urlscan for ip address", function () {
describe('Urlscan for ip address', function () {
const subject = new UrlscanForIP()

describe("#type", function () {
it("equals to ip_address", function () {
expect(subject.type).toEqual("ip_address")
describe('#type', function () {
it('equals to ip_address', function () {
expect(subject.type).toEqual('ip')
})
})

describe("#href", function () {
it("returns URL", function () {
const value = "1.1.1.1"
expect(subject.href(value)).toEqual("https://urlscan.io/ip/1.1.1.1")
describe('#href', function () {
it('returns URL', function () {
const value = '1.1.1.1'
expect(subject.href(value)).toEqual('https://urlscan.io/ip/1.1.1.1')
})
})
})

describe("Urlscan for domain", function () {
describe('Urlscan for domain', function () {
const subject = new UrlscanForDomain()

describe("#type", function () {
it("equals to domain", function () {
expect(subject.type).toEqual("domain")
describe('#type', function () {
it('equals to domain', function () {
expect(subject.type).toEqual('domain')
})
})

describe("#href", function () {
it("returns URL", function () {
const value = "example.com"
expect(subject.href(value)).toEqual("https://urlscan.io/domain/example.com")
describe('#href', function () {
it('returns URL', function () {
const value = 'example.com'
expect(subject.href(value)).toEqual('https://urlscan.io/domain/example.com')
})
})
})

describe("Urlscan for URL", function () {
describe('Urlscan for URL', function () {
const subject = new UrlscanForURL()

describe("#type", function () {
it("equals to domain", function () {
expect(subject.type).toEqual("url")
describe('#type', function () {
it('equals to domain', function () {
expect(subject.type).toEqual('url')
})
})

describe("#href", function () {
it("returns URL", function () {
const value = "http://example.com"
describe('#href', function () {
it('returns URL', function () {
const value = 'http://example.com'
expect(subject.href(value)).toEqual(
"https://urlscan.io/search/#task.url%3A%22http%3A%2F%2Fexample.com%22"
'https://urlscan.io/search/#task.url%3A%22http%3A%2F%2Fexample.com%22'
)
})
})
Expand Down
76 changes: 38 additions & 38 deletions frontend/tests/unit/links/virustotal.spec.ts
Original file line number Diff line number Diff line change
@@ -1,90 +1,90 @@
import { describe, expect, it } from "vitest"
import { describe, expect, it } from 'vitest'

import {
VirusTotalForDomain,
VirusTotalForIP,
VirusTotalForSHA256,
VirusTotalForURL
} from "@/links/virustotal"
} from '@/links/virustotal'

describe("VT for domain", function () {
describe('VT for domain', function () {
const subject = new VirusTotalForDomain()

describe("#type", function () {
it("equals to domain", function () {
expect(subject.type).toEqual("domain")
describe('#type', function () {
it('equals to domain', function () {
expect(subject.type).toEqual('domain')
})
})

describe("#href", function () {
it("returns URL", function () {
const value = "example.com"
describe('#href', function () {
it('returns URL', function () {
const value = 'example.com'
expect(subject.href(value)).toEqual(
"https://www.virustotal.com/gui/domain/example.com/details"
'https://www.virustotal.com/gui/domain/example.com/details'
)
})
})
})

describe("VT for ip address", function () {
describe('VT for ip address', function () {
const subject = new VirusTotalForIP()

describe("#type", function () {
it("equals to ip_address", function () {
expect(subject.type).toEqual("ip_address")
describe('#type', function () {
it('equals to ip_address', function () {
expect(subject.type).toEqual('ip')
})
})

describe("#href", function () {
it("returns URL", function () {
const value = "1.1.1.1"
describe('#href', function () {
it('returns URL', function () {
const value = '1.1.1.1'
expect(subject.href(value)).toEqual(
"https://www.virustotal.com/gui/ip-address/1.1.1.1/details"
'https://www.virustotal.com/gui/ip-address/1.1.1.1/details'
)
})
})
})

describe("VT for URL", function () {
describe('VT for URL', function () {
const subject = new VirusTotalForURL()

describe("#type", function () {
it("equals to url", function () {
expect(subject.type).toEqual("url")
describe('#type', function () {
it('equals to url', function () {
expect(subject.type).toEqual('url')
})
})

describe("#href", function () {
it("returns URL", function () {
expect(subject.href("https://virustotal.com/")).toEqual(
"https://www.virustotal.com/gui/url/77af0145fa9290ca3a4c214eb4561fc01070132300f6265e2c4cfb447372422e/details"
describe('#href', function () {
it('returns URL', function () {
expect(subject.href('https://virustotal.com/')).toEqual(
'https://www.virustotal.com/gui/url/77af0145fa9290ca3a4c214eb4561fc01070132300f6265e2c4cfb447372422e/details'
)

expect(subject.href("https://virustotal.com")).toEqual(
"https://www.virustotal.com/gui/url/77af0145fa9290ca3a4c214eb4561fc01070132300f6265e2c4cfb447372422e/details"
expect(subject.href('https://virustotal.com')).toEqual(
'https://www.virustotal.com/gui/url/77af0145fa9290ca3a4c214eb4561fc01070132300f6265e2c4cfb447372422e/details'
)

expect(subject.href("https://qiita.com/trend")).toEqual(
"https://www.virustotal.com/gui/url/5dd2d006b4430a593be125eee20494016d3ac933796da6deef590c3e045a685d/details"
expect(subject.href('https://qiita.com/trend')).toEqual(
'https://www.virustotal.com/gui/url/5dd2d006b4430a593be125eee20494016d3ac933796da6deef590c3e045a685d/details'
)
})
})
})

describe("VT for SHA256", function () {
describe('VT for SHA256', function () {
const subject = new VirusTotalForSHA256()

describe("#type", function () {
it("equals to sha256", function () {
expect(subject.type).toEqual("sha256")
describe('#type', function () {
it('equals to sha256', function () {
expect(subject.type).toEqual('sha256')
})
})

describe("#href", function () {
it("returns URL", function () {
const value = "275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f"
describe('#href', function () {
it('returns URL', function () {
const value = '275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f'
expect(subject.href(value)).toEqual(
"https://www.virustotal.com/gui/file/275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f/details"
'https://www.virustotal.com/gui/file/275a021bbfb6489e54d471899f7db9d1663fc695ec2fe2a2c4538aabf651fd0f/details'
)
})
})
Expand Down
10 changes: 0 additions & 10 deletions frontend/tests/unit/utils/comma_separated.spec.ts

This file was deleted.

Loading

0 comments on commit 4571e8f

Please sign in to comment.