issues

Github, Jira, Gitlab issues from Plan 9's acme
Log | Files | Refs | README | LICENSE

issue_test.go (1038B)


      1 package main
      2 
      3 import (
      4 	"strings"
      5 	"testing"
      6 )
      7 
      8 func TestParseIssue(t *testing.T) {
      9 	r := strings.NewReader(`Title: VizOne asset metadata fetched as XML, can get JSON
     10 State: opened
     11 Assignee:
     12 Created: 2022-08-04 03:04:01.233 +0000 UTC
     13 URL: https://gitlab.skyracing.cloud/sol1-software/ai/job-service/-/issues/22
     14 
     15 Woody helpfully showed us that we can get asset metadata as JSON instead of atom/xml! Cool!
     16 
     17 Right now we're importing a package xml2js then doing tedious object attribute traversal.
     18 
     19 const meta = {
     20   title: data['atom:entry']['atom:title'] ? data['atom:entry']['atom:title'][0] : null,
     21   video: data['atom:entry']['media:group'] ? data['atom:entry']['media:group'][0]['media:content'][0]['$'] : null,
     22   updated: data['atom:entry']['atom:updated'] ? data['atom:entry']['atom:updated'][0] : null,
     23   author: data['atom:entry']['atom:author'] ? data['atom:entry']['atom:author'][0]['atom:name'][0] : null,
     24   mediastatus: data['atom:entry']['mam:mediastatus'] ? data['atom:entry']['mam:mediastatus'][0] : null,`)
     25 	parseIssue(r)
     26 }