From 600866995a422d422b80e19d0014aa49282dae6e Mon Sep 17 00:00:00 2001 From: aggre Date: Wed, 28 Mar 2018 18:00:08 +0900 Subject: [PATCH] Add test for new feature of tagged projects --- src/elements/oo-projects/index.test.ts | 10 ++++ src/mock/stable/projects/publics/tag/test.md | 63 ++++++++++++++++++++ 2 files changed, 73 insertions(+) create mode 100644 src/mock/stable/projects/publics/tag/test.md diff --git a/src/elements/oo-projects/index.test.ts b/src/elements/oo-projects/index.test.ts index d2faf68..692839c 100644 --- a/src/elements/oo-projects/index.test.ts +++ b/src/elements/oo-projects/index.test.ts @@ -40,6 +40,16 @@ describe(`<${ELEMENT}>`, () => { expect(more).to.be.ok() }) + it('Fetch tagged public projects when exists "data-tag" attribute and not exists "data-iam" attribute value', async () => { + const element = insertElement(ELEMENT, new Map([['data-tag', 'test']])) + await sleep(300) + const items = element.shadowRoot.querySelectorAll('oo-atoms-message') + expect(items).to.have.length(2) + + const more = element.shadowRoot.querySelector('.paging > oo-atoms-button') + expect(more).to.be.ok() + }) + it('Show when no projects exists', async () => { const element: any = insertElement(ELEMENT, new Map([['data-iam', 'xxx']])) await sleep(300) diff --git a/src/mock/stable/projects/publics/tag/test.md b/src/mock/stable/projects/publics/tag/test.md new file mode 100644 index 0000000..8dcd895 --- /dev/null +++ b/src/mock/stable/projects/publics/tag/test.md @@ -0,0 +1,63 @@ ++++ +[headers] +access-control-allow-origin = "http://localhost:9876" +access-control-expose-headers = "x-oo-count" +x-oo-count = 4 ++++ + +```json +[ + { + "uid": "xLNf8Zw9G3FUTetr", + "created": 1516380671346, + "Extensions": [ + { + "key": "author", + "value": "test" + }, + { + "key": "approve", + "value": true + }, + { + "key": "users", + "value": ["test", "JEr9hsMH5m"] + }, + { + "key": "body", + "value": "test" + }, + { + "key": "tags", + "value": ["test"] + } + ] + }, + { + "uid": "y4Nd9DTGS74uUQss", + "created": 1516380661346, + "Extensions": [ + { + "key": "author", + "value": "xxx" + }, + { + "key": "approve", + "value": true + }, + { + "key": "users", + "value": ["test", "xxx", "JEr9hsMH5m"] + }, + { + "key": "body", + "value": "test" + }, + { + "key": "tags", + "value": ["test"] + } + ] + } +] +```